Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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"
5 changes: 5 additions & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
setlocal ENABLEDELAYEDEXPANSION

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

export SPYDER_QT_BINDING=conda-forge
$PYTHON -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
69 changes: 69 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% 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 }} # [unix and (build_platform != target_platform)]
- python # [win and (build_platform != target_platform)]
host:
- python {{ python_min }} # [unix]
- python # [win]
- pip
- setuptools
- packaging
run:
- python >={{ python_min }} # [unix]
- python # [win]
- 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: The Scientific Python Development Environment
description: |
Spyder is a powerful scientific environment written in Python, for Python,
and designed by and for scientists, engineers and data analysts.
It features a unique combination of the advanced editing, analysis,
debugging and profiling functionality of a comprehensive development tool
with the data exploration, interactive execution, deep inspection and
beautiful visualization capabilities of a scientific package.\n
Furthermore, Spyder offers built-in integration with many popular
scientific packages, including NumPy, SciPy, Pandas, IPython, QtConsole,
Matplotlib, SymPy, and more.\n
Beyond its many built-in features, Spyder can be extended even further via
third-party plugins.\n
Spyder can also be used as a PyQt5 extension library, allowing you to build
upon its functionality and embed its components, such as the interactive
console or advanced editor, in your own software.
doc_url: https://docs.spyder-ide.org/
dev_url: https://github.com/spyder-ide/spyder
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.