Skip to content

Commit

Permalink
use mamba [skip appveyor] [skip azurepipelines] [skip cirrus]
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Oct 24, 2023
1 parent 98e2e32 commit 1272d0a
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 145 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/build-conda-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
workflow_dispatch:
push:
branches:
- "micromamba-installer"
- 'master'
- 'releases/**'
- 'testing/**'
Expand All @@ -31,7 +32,7 @@ jobs:
matrix:
include:
- python-version: "3.9.12"
miniconda-version: "py39_4.12.0"
micromamba-version: "1.5.1-0"

defaults:
run:
Expand Down Expand Up @@ -90,15 +91,17 @@ jobs:
pyqt=5.15.* \
pyqtwebengine=5.15.* \
Orange3=$VERSION \
blas=*=openblas
blas=*=openblas \
mamba
conda list -p ./env --export --explicit --md5 > env-spec.txt
cat env-spec.txt
echo "CONDA_SPEC_FILE=env-spec.txt" >> $GITHUB_ENV
fi
- name: Build installer
env:
PLATTAG: win_amd64
MINICONDA_VERSION: ${{ matrix.miniconda-version }}
MICROMAMBA_VERSION: ${{ matrix.micromamba-version }}
run: |
mkdir dist
export PATH="$(cygpath -u 'C:\Program Files (x86)\NSIS'):$PATH"
Expand All @@ -107,7 +110,7 @@ jobs:
--platform $PLATTAG \
--cache-dir .cache \
--dist-dir dist \
--miniconda-version "$MINICONDA_VERSION" \
--micromamba-version "$MICROMAMBA_VERSION" \
--env-spec "$CONDA_SPEC_FILE" \
--online no
Expand Down Expand Up @@ -150,14 +153,21 @@ jobs:
$PYTHON -m pip list --format=freeze
# Test that orange and all dependencies are installed in a
# consistent state
$PYTHON -m pip install --no-index --no-cache-dir orange3
#$PYTHON -m pip install --no-index --no-cache-dir orange3
# Run test suite in the installed environment.
export ORANGE_DEPRECATIONS_ERROR=1
export PYTHONWARNINGS=module
$PYTHON -m unittest -v Orange.tests Orange.widgets.tests
- name: Test conda
shell: cmd.exe
run: |
C:\test-install\Scripts\conda.bat --help
C:\test-install\Scripts\conda.bat info
C:\test-install\Scripts\activate.bat
echo %CONDA_PREFIX%
package_portable:
name: Package a portable install
Expand Down
40 changes: 11 additions & 29 deletions scripts/windows/micromambainstall.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,16 @@ rem Target install prefix
set PREFIX=%~1
rem Path to micromamba executable
set MICROMAMBA=%~2
set MAMBA_ROOT_PREFIX=%~3

rem mamba has problems installing from "local" files? Make pkgs available in
rem pkg cache
rem mkdir "%PREFIX%\pkgs"
rem copy *.conda *.bz2 "%PREFIX%\pkgs"
rem !!! ~FIX THIS: !!! root prefix cannot be the same as install prefix ??!!!
rem !!! FIX THIS:Non-conda folder exists at prefix ?? !!!

if not exist "%PREFIX%\conda-meta" (
echo Creating a conda env in "%PREFIX%"
mkdir "%PREFIX%\conda-meta"
rem # Create an empty initial skeleton to layout the conda, activate.bat
rem # and other things needed to manage the environment.
call "%MICROMAMBA%" create --yes --root-prefix "%MAMBA_ROOT_PREFIX%" --prefix "%PREFIX%" --file .\conda-spec.txt ^
|| exit /b !ERRORLEVEL!
) else (
call "%MICROMAMBA%" install --yes --root-prefix "%MAMBA_ROOT_PREFIX%" --prefix "%PREFIX%" --file .\conda-spec.txt ^
|| exit /b !ERRORLEVEL!
)

call "%MICROMAMBA%" install --yes --root-prefix "%MAMBA_ROOT_PREFIX%" --prefix "%PREFIX%" mamba
if not exist "%PREFIX%\pkgs" (
mkdir "%PREFIX%\pkgs"
)
call "%MICROMAMBA%" install --yes --root-prefix "%PREFIX%" --prefix "%PREFIX%" --file .\conda-spec.txt ^
|| exit /b !ERRORLEVEL!

rem # Create .condarc file that includes conda-forge channel
rem # We need it so add-ons can be installed from conda-forge
Expand All @@ -36,21 +24,15 @@ echo channels: > "%PREFIX%\.condarc"
echo - conda-forge >> "%PREFIX%\.condarc"
echo - defaults >> "%PREFIX%\.condarc"

rem # bck compat
rem !!! the addon dialog uses uninstall command which micromamba does not support (uses remove)
rem !!! the addon dialog passes --skip-solve-satisfied which micromamba does not suppport
rem !! Use mamba?
rem Layout a backcompatible conda.bat file that dispatches to mamba,
rem for add-on dialog logic.
set "CONDA_BAT=%PREFIX%\Scripts\conda.bat"
echo @echo off> "%CONDA_BAT%"
echo call "%PREFIX%\condabin\mamba" --prefix "%PREFIX%" %%*>> "%CONDA_BAT%"
echo call "%%~dp0\mamba.exe" %%*>> "%CONDA_BAT%"

%MICROMAMBA% --root-prefix %MAMBA_ROOT_PREFIX% shell hook -s cmd.exe

set "ACTIVATE_BAT=%PREFIX%\Scripts\activate.bat"
if not exist "%ACTIVATE_BAT%" (
echo @echo off > "%ACTIVATE_BAT%"
echo call "%MAMBA_ROOT_PREFIX%\condabin\activate.bat" "%PREFIX%" >> "%ACTIVATE_BAT%"
)
rem Initialize activate hook, ...
"%MICROMAMBA%" --root-prefix "%PREFIX%" shell hook -s cmd.exe

rem # install custom sitecustomize module
copy sitecustomize.py "%PREFIX%\Lib\
exit 0
9 changes: 8 additions & 1 deletion scripts/windows/orange-conda.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ Section "Install required packages" InstallPackages
!else
# Run the install via from a helper script (informative output).
DetailPrint "Installing packages (this might take a while)"
${ExecToLog} 'cmd.exe /c install.bat "$PythonPrefix" "$InstDir\micromamba.exe" "$InstDir"'
${ExecToLog} 'cmd.exe /c install.bat "$PythonPrefix" "$InstDir\micromamba.exe"'
!endif # ONLINE
Pop $0
SetDetailsPrint none
Expand Down Expand Up @@ -490,6 +490,13 @@ Function un.InstallPackages
${If} $0 != 0
MessageBox MB_OK '"micromamba remove" command exited with an error ($0)'
${EndIf}
RMDir /r "$InstDir\pkgs"
RMDir /r "$InstDir\condabin"
RMDir /r "$InstDir\conda-meta"
RMDir /r "$InstDir\Scripts"
RMDir /r "$InstDir\Lib"
RMDir /r "$InstDir\share"
Delete "$InstDir\.condarc"
${Else}
${LogWrite} '"$InstDir" does not look like an ${APPNAME} installation. \
Not removing.'
Expand Down
Loading

0 comments on commit 1272d0a

Please sign in to comment.