From e9dfd3d0fbcfc65cb6921776ae71e93c4077abee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Erjavec?= Date: Fri, 20 Sep 2024 10:13:54 +0200 Subject: [PATCH] Replace Miniconda with Miniforge --- .github/workflows/build-conda-installer.yml | 6 +-- scripts/windows/PythonHelpers.nsh | 2 +- scripts/windows/build-conda-installer.sh | 42 ++++++++-------- scripts/windows/orange-conda.nsi | 54 ++++++++++----------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build-conda-installer.yml b/.github/workflows/build-conda-installer.yml index c6b9d61..a049cdd 100644 --- a/.github/workflows/build-conda-installer.yml +++ b/.github/workflows/build-conda-installer.yml @@ -31,7 +31,7 @@ jobs: matrix: include: - python-version: "3.11.8" - miniconda-version: "py311_24.1.2-0" + miniforge-version: "24.7.1-0" defaults: run: @@ -99,7 +99,7 @@ jobs: - name: Build installer env: PLATTAG: win_amd64 - MINICONDA_VERSION: ${{ matrix.miniconda-version }} + MINIFORGE_VERSION: ${{ matrix.miniforge-version }} run: | mkdir dist export PATH="$(cygpath -u 'C:\Program Files (x86)\NSIS'):$PATH" @@ -108,7 +108,7 @@ jobs: --platform $PLATTAG \ --cache-dir .cache \ --dist-dir dist \ - --miniconda-version "$MINICONDA_VERSION" \ + --miniforge-version "$MINIFORGE_VERSION" \ --env-spec "$CONDA_SPEC_FILE" \ --online no diff --git a/scripts/windows/PythonHelpers.nsh b/scripts/windows/PythonHelpers.nsh index 15d0774..b851fc6 100644 --- a/scripts/windows/PythonHelpers.nsh +++ b/scripts/windows/PythonHelpers.nsh @@ -206,7 +206,7 @@ FunctionEnd ReadRegStr $2 ${ROOT_KEY} \ "${__REG_PREFIX}\$1" "DisplayName" ${If} $2 != "" - ${StrStr} $3 $2 "Miniconda3" + ${StrStr} $3 $2 "Miniforge3" ${StrStr} $4 $2 "Anaconda3" ${LogWrite} " $3 $4" ${If} $3 != "" diff --git a/scripts/windows/build-conda-installer.sh b/scripts/windows/build-conda-installer.sh index f51880b..529fef8 100755 --- a/scripts/windows/build-conda-installer.sh +++ b/scripts/windows/build-conda-installer.sh @@ -17,15 +17,15 @@ Options: -d --dist-dir Distribution dir (default ./dist) --cache-dir Cache downloaded packages in DIR (the default is \"build/download-cache\") - -M, --miniconda-version - The miniconda distribution to include in the - installer (default ${MINICONDA_VERSION_DEFAULT}). + -M, --miniforge-version + The miniforge distribution to include in the + installer (default ${MINIFORGE_VERSION_DEFAULT}). --platform win32 or win_amd64 --env-spec An environment specification file as exported by \`conda list --export --explicit --md5\` (the default is specs/conda-spec.txt) --online (yes|no) Build an \"online\" or \"offline\" installer. - In an online installer only the Miniconda installer + In an online installer only the Miniforge installer is included. All other packages are otherwise fetched at installation time (offline is currently not recommended). @@ -46,10 +46,10 @@ BUILDBASE= DISTDIR= CACHEDIR= -# Miniconda installer version; included and installed if there is no existing -# Anaconda/Miniconda installation found on the target system. -MINICONDA_VERSION_DEFAULT=4.7.12 -MINICONDA_VERSION=${MINICONDA_VERSION_DEFAULT} +# Miniforge installer version; included and installed if there is no existing +# Anaconda/Miniforge installation found on the target system. +MINIFORGE_VERSION_DEFAULT=4.7.12 +MINIFORGE_VERSION=${MINIFORGE_VERSION_DEFAULT} PLATTAG=win_amd64 @@ -74,10 +74,10 @@ while [[ "${1:0:1}" = "-" ]]; do CACHEDIR=${2:?}; shift 2;; --cache-dir=*) CACHEDIR=${1#*=}; shift 1;; - -M|--miniconda-version) - MINICONDA_VERSION=${2:?}; shift 2;; - --miniconda-version=*) - MINICONDA_VERSION=${1*=}; shift 1;; + -M|--miniforge-version) + MINIFORGE_VERSION=${2:?}; shift 2;; + --miniforge-version=*) + MINIFORGE_VERSION=${1#*=}; shift 1;; --platform) PLATTAG=${2:?}; shift 2;; --platform=*) @@ -156,18 +156,18 @@ version-component() { echo "${vercomp[comindex]}" } -fetch-miniconda() { +fetch-miniforge() { local version="${1:?}" local platform="${2:?}" local destdir="${3:?}" - local url="https://repo.continuum.io/miniconda" + local url="https://github.com/conda-forge/miniforge/releases/download/${version}" local filename= case "${platform}" in win32) - filename=Miniconda3-"${version}"-Windows-x86.exe + filename=Miniforge3-"${version}"-Windows-x86.exe ;; win_amd64) - filename=Miniconda3-"${version}"-Windows-x86_64.exe + filename=Miniforge3-"${version}"-Windows-x86_64.exe ;; *) echo "Wrong platform" >&2; return 1;; @@ -309,9 +309,9 @@ make-installer() { local scriptdir="$(dirname "$0")" local nsis_script="${scriptdir:?}/orange-conda.nsi" local outpath=${DISTDIR:?} - local filename=${NAME:?}-${VERSION:?}-Miniconda-${CONDAPLATTAG}.exe - local pyinstaller=Miniconda3-${MINICONDA_VERSION:?}-Windows-${CONDAPLATTAG}.exe - local extransisparams=( -DMINICONDA_VERSION=${MINICONDA_VERSION:?} ) + local filename=${NAME:?}-${VERSION:?}-Miniforge-${CONDAPLATTAG}.exe + local pyinstaller=Miniforge3-${MINIFORGE_VERSION:?}-Windows-${CONDAPLATTAG}.exe + local extransisparams=( -DMINIFORGE_VERSION=${MINIFORGE_VERSION:?} ) if [[ "${ONLINE}" == yes ]]; then extransisparams+=( -DONLINE ) else @@ -358,7 +358,7 @@ EOF "${nsis_script:?}" } -fetch-miniconda ${MINICONDA_VERSION} ${PLATTAG} "${CACHEDIR:?}"/miniconda +fetch-miniforge ${MINIFORGE_VERSION} ${PLATTAG} "${CACHEDIR:?}"/miniforge if [[ "${ONLINE}" == yes ]]; then cat > "${BASEDIR}"/conda-spec.txt < "${ENV_SPEC_FILE}" @@ -388,7 +388,7 @@ if [[ ! "${PYTHON_VERSION}" ]]; then exit 1; fi -cp "${CACHEDIR:?}/miniconda/Miniconda3-${MINICONDA_VERSION}-Windows-${CONDAPLATTAG}.exe" \ +cp "${CACHEDIR:?}/miniforge/Miniforge3-${MINIFORGE_VERSION}-Windows-${CONDAPLATTAG}.exe" \ "${BASEDIR:?}/" mkdir -p "${BASEDIR:?}/icons" diff --git a/scripts/windows/orange-conda.nsi b/scripts/windows/orange-conda.nsi index f3b81d0..315b642 100644 --- a/scripts/windows/orange-conda.nsi +++ b/scripts/windows/orange-conda.nsi @@ -8,8 +8,8 @@ # - PY{MAJOR,MINOR,MICRO} Python version to be installed in the new env # - APPNAME Application (short) name # - VER{MAJOR,MINOR,MICRO} Application version -# - PYINSTALLER basename of the Miniconda python installer -# - INSTALL_REGISTRY_KEY reg subkey name to use for storing install infomation +# - PYINSTALLER basename of the Miniforge python installer +# - INSTALL_REGISTRY_KEY reg subkey name to use for storing install information # (details will be stored under Software/${INSTALL_REGISTRY_KEY}) @@ -383,46 +383,46 @@ Function RestoreSilentInstallDir FunctionEnd -# Section Miniconda +# Section Miniforge # ----------------- -# A Miniconda Python distributions -Section "Miniconda ${MINICONDA_VERSION}" \ - SectionMiniconda +# A Miniforge Python distributions +Section "Miniforge ${MINIFORGE_VERSION}" \ + SectionMiniforge ${GetAnyAnacondaInstall} $BasePythonPrefix $PythonInstallMode ${If} $BasePythonPrefix != "" ${LogWrite} "Using exising (Ana|Mini)conda installed in \ $BasePythonPrefix" ${Else} ${ExtractTemp} "${BASEDIR}\${PYINSTALLER}" "${TEMPDIR}" - DetailPrint "Installing Miniconda ${MINICONDA_VERSION}" + DetailPrint "Installing Miniforge ${MINIFORGE_VERSION}" # Why does executing "${TEMPDIR}\${PYINSTALLER}" directly hang the - # Miniconda installer? + # Miniforge installer? ${If} ${Silent} StrCpy $0 "/S /AddToPath=0 /RegisterPython=0" ${Else} StrCpy $0 "" ${EndIf} MessageBox MB_OKCANCEL \ - '${APPLICATIONNAME} requires a Miniconda Python distribution \ + '${APPLICATIONNAME} requires a Miniforge Python distribution \ installed on the system. This will be done by running a separate \ installer program.$\r$\n$\r$\n\ Click Ok to continue.' \ - /SD IDOK IDOK continue_miniconda_ IDCANCEL abort_miniconda_ - abort_miniconda_: - Abort "Aborting Miniconda installation (user cancelled)." - continue_miniconda_: - ${LogWrite} "Running miniconda installer" + /SD IDOK IDOK continue_miniforge_ IDCANCEL abort_miniforge_ + abort_miniforge_: + Abort "Aborting Miniforge installation (user cancelled)." + continue_miniforge_: + ${LogWrite} "Running miniforge installer" ${ExecToLog} 'cmd.exe /C "${TEMPDIR}\${PYINSTALLER}" \ $0 /InstallationType=$MultiUser.InstallMode \ ' Pop $0 ${If} $0 != 0 - Abort "Miniconda installation failed (error value: $0)" + Abort "Miniforge installation failed (error value: $0)" ${EndIf} ${GetAnyAnacondaInstall} $BasePythonPrefix $PythonInstallMode ${If} $BasePythonPrefix == "" Abort "No anaconda distribution found. Cannot proceed.$\r$\n \ - Make sure Miniconda was installed successfully." + Make sure Miniforge was installed successfully." ${EndIF} ${IfNot} ${FileExists} "$BasePythonPrefix\python.exe" Abort "No python.exe found in $BasePythonPrefix$\r$\n \ @@ -432,12 +432,12 @@ Section "Miniconda ${MINICONDA_VERSION}" \ ${LogWrite} "Using conda installation: $BasePythonPrefix" SectionEnd -Function un.Miniconda +Function un.Miniforge # Nothing to do. Anaconda installation has its own uninstall. FunctionEnd -Section "-Miniconda env setup" SectionEnvSetup +Section "-Miniforge env setup" SectionEnvSetup # Setup the PythonPrefix/PythonExecPrefix... variables # but does not actualy create any env (this is done in single step # in InstallPackages section @@ -760,8 +760,8 @@ FunctionEnd !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN -!insertmacro MUI_DESCRIPTION_TEXT ${SectionMiniconda} \ - "Install Miniconda ${MINICONDA_VERSION} (${BITS} bit)" +!insertmacro MUI_DESCRIPTION_TEXT ${SectionMiniforge} \ + "Install Miniforge ${MINIFORGE_VERSION} (${BITS} bit)" !insertmacro MUI_DESCRIPTION_TEXT ${InstallPackages} \ "Install required packages into the destination environment" @@ -790,7 +790,7 @@ Section Uninstall Call un.Launchers Call un.InstallPackages Call un.Environment - Call un.Miniconda + Call un.Miniforge ${If} ${FileExists} "$InstDir\${UNINSTALL_EXEFILE}" Delete "$InstDir\${UNINSTALL_EXEFILE}" @@ -823,14 +823,14 @@ Function .onInit # Found an appropriate python installation and can reuse it # Change the SectionPython to Unselected # (change text to Install (use) Private Python?) - SectionGetText ${SectionMiniconda} $0 - SectionSetText ${SectionMiniconda} \ + SectionGetText ${SectionMiniforge} $0 + SectionSetText ${SectionMiniforge} \ "Anaconda python distribution (already installed)" - !insertmacro UnselectSection ${SectionMiniconda} - !insertmacro SetSectionFlag ${SectionMiniconda} ${SF_RO} + !insertmacro UnselectSection ${SectionMiniforge} + !insertmacro SetSectionFlag ${SectionMiniforge} ${SF_RO} ${Else} - !insertmacro SelectSection ${SectionMiniconda} - !insertmacro SetSectionFlag ${SectionMiniconda} ${SF_RO} + !insertmacro SelectSection ${SectionMiniforge} + !insertmacro SetSectionFlag ${SectionMiniforge} ${SF_RO} ${EndIf} FunctionEnd