Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions .github/workflows/build-updater.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Updater Release

on:
pull_request:
branches:
- main

release:
types:
- created

workflow_dispatch:
inputs:
pre:
description: 'Build as release candidate'
required: false
default: true
type: boolean
ssh:
# github_cli: gh workflow run updater-release.yml --repo spyder-ide/spyder-updater --ref <branch> -f ssh=true
description: 'Enable ssh debugging'
required: false
default: false
type: boolean

concurrency:
group: updater-release-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build conda package
runs-on: ubuntu-latest
defaults:
run:
shell: bash -le {0}

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Remote SSH Connection
if: inputs.ssh
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
with:
detached: true

- name: Setup Build Environment
uses: mamba-org/setup-micromamba@v1
with:
condarc: |
conda_build:
pkg_format: '2'
zstd_compression_level: '19'
channels:
- conda-forge
environment-name: build
create-args: >-
python=3.11
conda-build
conda-lock
cache-downloads: true
cache-environment: true

- name: Environment Variables
run: |
export DISTDIR=${GITHUB_WORKSPACE}/dist
echo "DISTDIR=$DISTDIR" >> $GITHUB_ENV
mkdir -p $DISTDIR

export CONDA_BLD_PATH=${RUNNER_TEMP}/conda-bld
echo "CONDA_BLD_PATH=$CONDA_BLD_PATH" >> $GITHUB_ENV
mkdir -p $CONDA_BLD_PATH

conda config --set bld_path $CONDA_BLD_PATH
conda config --set conda_build.root-dir $CONDA_BLD_PATH

env | sort

- name: Build spyder-updater Conda Package
run: |
conda build --no-anaconda-upload recipe

- name: Create Conda Lock Files
run: |
conda-lock lock -c conda-forge --kind explicit --file pyproject.toml --filename-template $DISTDIR/conda-updater-{platform}.lock

- name: Create Distribution File
working-directory: ${{ env.DISTDIR }}
run: |
mv $CONDA_BLD_PATH/noarch/*.conda .
zip -mT spyder-updater *.lock *.conda

- name: Create Checksums
working-directory: ${{ env.DISTDIR }}
run: |
sha256sum spyder-updater.zip > Spyder-Updater-checksums.txt

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: ${{ env.DISTDIR }}
name: spyder-updater-artifact

- name: Get Release
if: github.event_name == 'release'
uses: bruceadams/get-release@v1.3.2
id: get_release
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload Release Asset
if: github.event_name == 'release'
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ env.DISTDIR }}/*.*
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ Source = "https://github.com/spyder-ide/spyder-updater"

[tool.setuptools.dynamic]
version = {attr = "spyder_updater.__version__"}

[tool.setuptools.package-data]
"spyder_updater.scripts" = ["*.bat", "*.sh"]
"spyder_updater.gui.assets" = ["*.json", "*.svg"]

[project.scripts]
spyder-updater = "spyder_updater.start:main"
4 changes: 4 additions & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
setlocal ENABLEDELAYEDEXPANSION

%PYTHON% -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
if errorlevel 1 exit 1
3 changes: 3 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

$PYTHON -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
54 changes: 54 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% set version = "0.1.0.dev0" %}
{% set python_min = "3.9" %}
{% set build = 0 %}

package:
name: spyder-updater
version: {{ version }}

source:
path: ../

build:
number: {{ build }}
entry_points:
- spyder-updater = spyder_updater.start:main
noarch: python

requirements:
build:
- python >={{ python_min }}
host:
- python {{ python_min }}
- pip
- setuptools
- packaging
run:
- python >={{ python_min }}
- jsonschema
- pyqt
- qdarkstyle
- qstylizer
- qtawesome
- qtpy
- superqt

test:
requires:
- pip
commands:
- spyder-updater -h
- python -m pip check
imports:
- spyder_updater

about:
home: https://www.spyder-ide.org/
license: MIT
license_file: LICENSE.txt
summary: Updater for the Spyder standalone installers
description: |
It provides a graphical interface and the necessary scripts to perform the
update in a separate environment.
doc_url: https://docs.spyder-ide.org/
dev_url: https://github.com/spyder-ide/spyder-updater
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ def _handle_error(self, error):
def start_install(self):
# Install script
script_name = 'install.' + ('bat' if os.name == 'nt' else 'sh')
script_path = str(Path(__file__).parent / 'scripts' / script_name)
script_path = str(
Path(__file__).parent.parent / 'scripts' / script_name
)

# Sub command
if self._update_info.get("installation_script") is None:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,24 @@ chcp 65001>nul
echo.
echo =========================================================
echo Updating Spyder
echo ---------------
echo.
echo IMPORTANT: Do not close this window until it has finished
echo =========================================================
echo.

call :wait_for_spyder_quit

IF exist "%conda%" IF exist "%prefix%" (
call :update_subroutine
set /P =Press return to exit and launch Spyder...
call :launch_spyder
goto exit
goto :exit
)

IF exist "%install_file%" (
call :install_subroutine
goto exit
goto :exit
)

:exit
exit %ERRORLEVEL%
exit %ERRORLEVEL%

:wait_for_spyder_quit
echo Waiting for Spyder to quit...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash -i

unset HISTFILE # Do not write to history with interactive shell
#!/bin/bash

while getopts "i:c:p:r" option; do
case "$option" in
Expand Down Expand Up @@ -72,9 +70,6 @@ install_spyder(){
cat <<EOF
=========================================================
Updating Spyder
---------------

IMPORTANT: Do not close this window until it has finished
=========================================================

EOF
Expand All @@ -88,13 +83,7 @@ echo "Spyder quit."

if [[ -e "$conda" && -d "$prefix" ]]; then
update_spyder
read -p "Press return to exit and launch Spyder..."
launch_spyder
else
install_spyder
fi

if [[ "$OSTYPE" = "darwin"* ]]; then
# Close the Terminal window that was opened for this process
osascript -e 'tell application "Terminal" to close first window' &
fi
18 changes: 14 additions & 4 deletions spyder_updater/start-update.py → src/spyder_updater/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from qtpy.QtGui import QIcon

# Local imports
# TODO: Use absolute imports here
from spyder_updater import __version__
from spyder_updater.gui.updater import Updater
from spyder_updater.gui.utils import UpdaterApplication, validate_schema


def main(argv):
def main():
"""Run updater."""
# Parser instance
parser = argparse.ArgumentParser(usage="update-spyder [options]")
Expand All @@ -32,9 +32,19 @@ def main(argv):
type=argparse.FileType(),
help="Path to file that has the info to update Spyder"
)
parser.add_argument(
"--version",
action="store_true",
help="Return spyder-updater version and exit."
)

args = parser.parse_args()

if args.version:
sys.stdout.write(__version__ + "\n")
return

# Get info from update file
args = parser.parse_args(argv[1:])
update_info = json.loads(args.file.read())

# Validate that info conforms to our schema
Expand Down Expand Up @@ -65,4 +75,4 @@ def main(argv):


if __name__ == '__main__':
main(sys.argv)
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.