Skip to content

Commit

Permalink
Merge pull request #21647 from mrclary/issue-21640-fix-update-2
Browse files Browse the repository at this point in the history
PR: Update for new menuinst and friends and new Spyder feedstock
  • Loading branch information
ccordoba12 authored Feb 8, 2024
2 parents 55e92d7 + accc1c2 commit 345efc2
Show file tree
Hide file tree
Showing 17 changed files with 355 additions and 273 deletions.
75 changes: 75 additions & 0 deletions .github/scripts/installer_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash

# This script tests the installer for macOS and Linux on CI
# and will only install for the local user.

exit_status=0

install() {
if [[ "$OSTYPE" == "darwin"* ]]; then
# Stream install.log to stdout to view all log messages.
tail -F /var/log/install.log & tail_id=$!
trap "kill -s TERM $tail_id" EXIT

installer -pkg $PKG_PATH -target CurrentUserHomeDirectory >/dev/null
elif [[ "$OSTYPE" == "linux"* ]]; then
$PKG_PATH -b
fi
}

check_prefix() {
if [[ "$OSTYPE" == "darwin"* ]]; then
base_prefix=$(compgen -G $HOME/Library/spyder-*)
elif [[ "$OSTYPE" == "linux"* ]]; then
base_prefix=$(compgen -G $HOME/.local/spyder-*)
fi

if [[ -d "$base_prefix" ]]; then
echo "\nContents of ${base_prefix}:"
ls -al $base_prefix
else
echo "$base_prefix does not exist!"
exit 1
fi
}

check_uninstall() {
if [[ -e "${base_prefix}/uninstall-spyder.sh" ]]; then
echo -e "\nContents of ${base_prefix}/uninstall-spyder.sh:"
cat $base_prefix/uninstall-spyder.sh
else
echo "${base_prefix}/uninstall-spyder.sh does not exist!"
exit_status=1
fi
}

check_shortcut() {
pythonexe=${base_prefix}/bin/python
menuinst=${base_prefix}/bin/menuinst_cli.py
shortcut=$($pythonexe $menuinst shortcut --mode=user)
if [[ -e "${shortcut}" ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "\n${shortcut}/Contents/MacOS contents:"
ls -al "${shortcut}/Contents/MacOS"
echo -e "\n$shortcut/Contents/Info.plist contents:"
cat "${shortcut}/Contents/Info.plist"
script=$(compgen -G "${shortcut}/Contents/MacOS/spyder"*-script)
echo -e "\n${script} contents:"
cat "${script}"
elif [[ "$OSTYPE" == "linux"* ]]; then
echo -e "\n${shortcut} contents:"
cat $shortcut
fi
else
echo "$shortcut does not exist"
exit_status=1
fi
}

install
echo "Install info:"
check_prefix
check_uninstall
check_shortcut

exit $exit_status
2 changes: 1 addition & 1 deletion .github/workflows/build-subrepos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
environment-file: installers-conda/build-environment.yml
environment-name: spy-inst
create-args: >-
--channel-priority=strict
--channel-priority=flexible
python=${{ matrix.python-version }}
cache-downloads: true
cache-environment: true
Expand Down
90 changes: 30 additions & 60 deletions .github/workflows/installers-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:
MACOS_INSTALLER_CERTIFICATE: ${{ secrets.MACOS_INSTALLER_CERTIFICATE }}
APPLICATION_PWD: ${{ secrets.APPLICATION_PWD }}
CONSTRUCTOR_TARGET_PLATFORM: ${{ matrix.target-platform }}
NSIS_USING_LOG_BUILD: 1

steps:
- name: Checkout Code
Expand Down Expand Up @@ -156,13 +157,27 @@ jobs:
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Setup Build Environment
- name: Setup Build Environment (Windows)
if: runner.os == 'Windows'
uses: mamba-org/setup-micromamba@v1
with:
environment-file: installers-conda/build-environment.yml
environment-name: spy-inst
create-args: >-
--channel-priority=strict
--channel-priority=flexible
python=${{ matrix.python-version }}
nsis>=3.08=*_log_*
cache-downloads: true
cache-environment: true

- name: Setup Build Environment (macOS & Linux)
if: runner.os != 'Windows'
uses: mamba-org/setup-micromamba@v1
with:
environment-file: installers-conda/build-environment.yml
environment-name: spy-inst
create-args: >-
--channel-priority=flexible
python=${{ matrix.python-version }}
cache-downloads: true
cache-environment: true
Expand All @@ -185,7 +200,7 @@ jobs:
CONDA_BLD_PATH: ${{ runner.temp }}/conda-bld
run: |
conda config --set bld_path $CONDA_BLD_PATH
mamba index $CONDA_BLD_PATH
conda index $CONDA_BLD_PATH
mamba search -c local --override-channels || true
- name: Create Keychain
Expand Down Expand Up @@ -225,70 +240,25 @@ jobs:
echo "PKG_GLOB=$PKG_GLOB" >> $GITHUB_ENV
echo "PKG_BASE_NAME=$PKG_BASE_NAME" >> $GITHUB_ENV
- name: Test macOS Installer
if: runner.os == 'macOS'
run: |
# Stream install.log to stdout to view all log messages.
tail -F /var/log/install.log & tail_id=$!
trap "kill -s TERM $tail_id" EXIT
installer -pkg $PKG_PATH -target CurrentUserHomeDirectory >/dev/null
root_prefix=$(compgen -G $HOME/Library/spyder-*)
echo "Install info:"
echo "Contents of ${root_prefix}:"
ls -al $root_prefix
echo -e "\nContents of ${root_prefix}/uninstall-spyder.sh:"
cat $root_prefix/uninstall-spyder.sh
app_path=/Applications/Spyder.app
[[ -e ${root_prefix}/.nonadmin ]] && app_path=${HOME}${app_path}
if [[ -e "$app_path" ]]; then
echo "Contents of $app_path/Contents/MacOS:"
ls -al $app_path/Contents/MacOS
echo -e "\nContents of $app_path/Contents/Info.plist:"
cat $app_path/Contents/Info.plist
echo -e "\nContents of $app_path/Contents/MacOS/spyder-script:"
cat $app_path/Contents/MacOS/spyder-script
else
echo "$app_path does not exist"
exit 1
fi
- name: Test Linux Installer
if: runner.os == 'Linux'
run: |
$PKG_PATH -b
root_prefix=$(compgen -G $HOME/.local/spyder-*)
echo "Install info:"
echo "Contents of ${root_prefix}:"
ls -al $root_prefix
echo -e "\nContents of ${root_prefix}/uninstall-spyder.sh:"
cat ${root_prefix}/uninstall-spyder.sh
shortcut_path=/share/applications/spyder_spyder.desktop
[[ -e ${root_prefix}/.nonadmin ]] && shortcut_path=${HOME}/.local${shortcut_path} || shortcut_path=/usr${shortcut_path}
if [[ -e $shortcut_path ]]; then
echo -e "\nContents of ${shortcut_path}:"
cat $shortcut_path
else
echo "$shortcut_path does not exist"
exit 1
fi
- name: Test macOS or Linux Installer
if: runner.os != 'Windows'
run: ${{ github.workspace }}/.github/scripts/installer_test.sh

- name: Test Windows Installer
if: runner.os == 'Windows'
shell: cmd
run: |
set base_prefix=%USERPROFILE%\AppData\Local\spyder-6
start /wait %PKG_PATH% /InstallationType=JustMe /NoRegistry=1 /S
if exist %base_prefix%\install.log type %base_prefix%\install.log
set "shortcut_path=%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\spyder\Spyder.lnk"
if exist "%shortcut_path%" (
set mode=system
for /F "tokens=*" %%i in (
'%base_prefix%\python %base_prefix%\Scripts\menuinst_cli.py shortcut --mode=%mode%'
) do (
set shortcut=%%~fi
)
if exist "%shortcut%" (
echo "Spyder installed successfully"
) else (
echo "Spyder NOT installed successfully"
Expand Down
10 changes: 5 additions & 5 deletions installers-conda/build-environment.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: spy-inst
channels:
- napari/label/bundle_tools_3
- conda-forge
dependencies:
- boa
- conda
- conda-standalone
- constructor
- conda >=23.11.0
- conda-standalone >=23.11.0
- constructor >=3.6.0
- gitpython
- menuinst
- mamba
- menuinst >=2.0.2
- ruamel.yaml.jinja2
- setuptools_scm
Loading

0 comments on commit 345efc2

Please sign in to comment.