Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Do not launch Spyder if installing in CI or batch/silent mode (Installers) #22876

Merged
merged 5 commits into from
Nov 7, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/installers-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- 'installers-conda/**'
- '.github/workflows/installers-conda.yml'
- '.github/scripts/installer_test.sh'
- 'requirements/*.yml'
- 'MANIFEST.in'

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

pull_request:
branches:
Expand All @@ -36,6 +37,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

workflow_call:

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

pull_request:
branches:
Expand All @@ -36,6 +37,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

workflow_call:

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

pull_request:
branches:
Expand All @@ -36,6 +37,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

workflow_call:

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-remoteclient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

pull_request:
branches:
Expand All @@ -32,6 +33,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

workflow_call:

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

pull_request:
branches:
Expand All @@ -36,6 +37,7 @@ on:
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

workflow_call:

Expand Down
26 changes: 23 additions & 3 deletions installers-conda/resources/post-install.bat
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
rem This script launches Spyder after install
@rem This script launches Spyder after install
@echo off

call :redirect 2>&1 >> %PREFIX%\install.log

:redirect
@echo Environment Variables:
set

if defined CI set no_launch_spyder=true
if "%INSTALLER_UNATTENDED%"=="1" set no_launch_spyder=true
@echo CI = %CI%
@echo INSTALLER_UNATTENDED = %INSTALLER_UNATTENDED%
@echo no_launch_spyder = %no_launch_spyder%
if defined no_launch_spyder (
@echo Installing in silent mode, do not launch Spyder
exit /b %errorlevel%
) else (
@echo Launching Spyder after install completed.
)

set mode=system
if exist "%PREFIX%\.nonadmin" set mode=user

rem Get shortcut path
@rem Get shortcut path
for /F "tokens=*" %%i in (
'%PREFIX%\python %PREFIX%\Scripts\menuinst_cli.py shortcut --mode=%mode%'
) do (
set shortcut=%%~fi
)
@echo shortcut = %shortcut%

rem Launch Spyder
@rem Launch Spyder
set tmpdir=%TMP%\spyder
set launch_script=%tmpdir%\launch_script.bat

Expand All @@ -21,6 +40,7 @@ echo @echo off
echo :loop
echo tasklist /fi "ImageName eq Spyder-*" /fo csv 2^>NUL ^| findstr /r "Spyder-.*Windows-x86_64.exe"^>NUL
echo if "%%errorlevel%%"=="0" ^(
echo @rem Installer is still running
echo timeout /t 1 /nobreak ^> nul
echo goto loop
echo ^) else ^(
Expand Down
5 changes: 4 additions & 1 deletion installers-conda/resources/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ fi
echo "*** Post install script for ${INSTALLER_NAME} complete"

# ---- Launch Spyder
[[ -n "$CI" ]] && exit 0 # Running in CI, don't launch Spyder
if [[ -n "$CI" || "$INSTALLER_UNATTENDED" == "1" || "$COMMAND_LINE_INSTALL" == "1" ]]; then
echo Installing in batch mode, do not launch Spyder
exit 0
fi

echo "Launching Spyder now..."
if [[ "$OSTYPE" == "darwin"* ]]; then
Expand Down
2 changes: 1 addition & 1 deletion installers-conda/resources/pre-install.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rem Mark as conda-based-app
@rem Mark as conda-based-app
set menudir=%PREFIX%\envs\spyder-runtime\Menu
if not exist "%menudir%" mkdir "%menudir%"
echo. > "%menudir%\conda-based-app"
Loading