Skip to content

Commit

Permalink
Replace Miniconda with Miniforge
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Sep 20, 2024
1 parent e6f631a commit e9dfd3d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 52 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-conda-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/windows/PythonHelpers.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -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 != ""
Expand Down
42 changes: 21 additions & 21 deletions scripts/windows/build-conda-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Options:
-d --dist-dir <path> Distribution dir (default ./dist)
--cache-dir <path> Cache downloaded packages in DIR (the default
is \"build/download-cache\")
-M, --miniconda-version <version>
The miniconda distribution to include in the
installer (default ${MINICONDA_VERSION_DEFAULT}).
-M, --miniforge-version <version>
The miniforge distribution to include in the
installer (default ${MINIFORGE_VERSION_DEFAULT}).
--platform <plattag> 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).
Expand All @@ -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

Expand All @@ -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=*)
Expand Down Expand Up @@ -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;;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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"
Expand Down
54 changes: 27 additions & 27 deletions scripts/windows/orange-conda.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -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})


Expand Down Expand Up @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e9dfd3d

Please sign in to comment.