Skip to content

Commit 04c6062

Browse files
authored
Merge pull request #2183 from mccode-dev/consolidate-micromamba-bulky-installers
Consolidate micromamba bulky installers
2 parents 1e38670 + c2dc81d commit 04c6062

File tree

9 files changed

+80
-99
lines changed

9 files changed

+80
-99
lines changed

buildscripts/build_windows_mcstas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ export MCCODE_USE_LEGACY_DESTINATIONS=ON
6161
if [ "x$2" != "x" ]; then
6262
# Build the meta-packages also
6363
cd meta-pkgs/windows/Support
64-
if [ -f Miniforge3-Windows-x86_64.exe ]; then
65-
rm Miniforge3-Windows-x86_64.exe
64+
if [ -f micromamba.exe ]; then
65+
rm micromamba.exe
6666
fi
67-
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe
67+
curl -Ls https://micro.mamba.pm/api/micromamba/win-64/latest | tar -xvj Library/bin/micromamba.exe && mv Library/bin/micromamba.exe .
6868
cd ..
6969

7070
rm -f python-install.bat.in.2 python-install.bat docupdate.bat.in.2 docupdate.bat

buildscripts/build_windows_mcxtrace

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ export MCCODE_USE_LEGACY_DESTINATIONS=ON
5858
if [ "x$2" != "x" ]; then
5959
# Build the meta-packages also
6060
cd meta-pkgs/windows/Support
61-
if [ -f Miniforge3-Windows-x86_64.exe ]; then
62-
rm Miniforge3-Windows-x86_64.exe
61+
if [ -f micromamba.exe ]; then
62+
rm micromamba.exe
6363
fi
64-
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe
64+
curl -Ls https://micro.mamba.pm/api/micromamba/win-64/latest | tar -xvj Library/bin/micromamba.exe && mv Library/bin/micromamba.exe .
6565
cd ..
6666

6767
rm -f python-install.bat.in.2 python-install.bat docupdate.bat.in.2 docupdate.bat

meta-pkgs/windows/McStas-metapackage64.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Source: "dist\mcstas-tools-python-mcdisplay-pyqtgraph-NSIS64-@VERSION@-mingw64.e
5353
Source: "dist\mcstas-tools-python-mcdisplay-matplotlib-NSIS64-@VERSION@-mingw64.exe"; DestDir: "{tmp}"
5454
Source: "dist\mcstas-tools-python-mcdisplay-mantid-NSIS64-@VERSION@-mingw64.exe"; DestDir: "{tmp}"
5555
Source: "dist\mcstas-tools-python-mcdoc-NSIS64-@VERSION@-mingw64.exe"; DestDir: "{tmp}"
56-
Source: "Support\Miniforge3-Windows-x86_64.exe"; DestDir: "{tmp}"
56+
Source: "Support\micromamba.exe"; DestDir: "{tmp}"
5757

5858
[Run]
5959
Filename: "{tmp}\python-install.bat"

meta-pkgs/windows/McXtrace-metapackage64.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Source: "dist\mcxtrace-tools-python-mxdisplay-webgl-NSIS64-@VERSION@-mingw64.exe
4848
Source: "dist\mcxtrace-tools-python-mxdisplay-pyqtgraph-NSIS64-@VERSION@-mingw64.exe"; DestDir: "{tmp}"
4949
Source: "dist\mcxtrace-tools-python-mxdisplay-matplotlib-NSIS64-@VERSION@-mingw64.exe"; DestDir: "{tmp}"
5050
Source: "dist\mcxtrace-tools-python-mxdoc-NSIS64-@VERSION@-mingw64.exe"; DestDir: "{tmp}"
51-
Source: "Support\Miniforge3-Windows-x86_64.exe"; DestDir: "{tmp}"
51+
Source: "Support\micromamba.exe"; DestDir: "{tmp}"
5252

5353
[Run]
5454
Filename: "{tmp}\python-install.bat"

meta-pkgs/windows/python-install.bat.in

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@
55
@echo WARNING: Please wait, process may take several minutes to complete!
66
@echo (Pressing [enter] a few times to ensure something is happening is OK)
77
@echo ...
8-
@start /wait "" Miniforge3-Windows-x86_64.exe /S /AddToPath=0 /D=c:\@FLAVOR@-@VERSION@\miniconda3
9-
@echo Mambaforge install completed, proceeding with McCode dependencies...
10-
@SET PATH=c:\@FLAVOR@-@VERSION@\bin;c:\@FLAVOR@-@VERSION@\miniconda3;c:\@FLAVOR@-@VERSION@\miniconda3\Scripts\;c:\@FLAVOR@-@VERSION@\miniconda3\Library\bin;c:\@FLAVOR@-@VERSION@\miniconda3\Library\mingw-w64\bin;%PATH%
11-
@REM update conda and install mamba
12-
@set CONDA_NO_PLUGINS=true
13-
@conda config --set solver classic
14-
@conda install -n base conda-libmamba-solver --solver=classic -y
15-
@conda env update --name base --file environment.yml --solver=classic
16-
@conda clean --all -y
8+
@micromamba.exe create -p c:\@FLAVOR@-@VERSION@\miniconda3 --file environment.yml -y
9+
@echo micromamba install completed, including McCode dependencies...
10+
@micromamba.exe clean --all -y
1711
@echo ...
1812
@echo Press a key below to exit this installation shell...
1913
@echo ...

support/MacOSX/McCode-conda.app/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,20 @@ message("Enabling ${FLAVOR} flavor")
2929
if (DEFINED ARCH_ENABLE)
3030
message("Enabling archictecture ${ARCH_ENABLE}")
3131
set(SHEBANG "/usr/bin/arch -${ARCH_ENABLE} /usr/bin/env bash")
32+
if ("${ARCH_ENABLE}" STREQUAL "arm64" )
33+
set(CONDAARCH "osx-arm64")
34+
else()
35+
set(CONDAARCH "osx-64")
36+
endif()
3237
else()
3338
message("Auto-detecting archictecture ...")
3439
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64" )
3540
message("Enabling archictecture ${CMAKE_SYSTEM_PROCESSOR}")
3641
set(SHEBANG "/usr/bin/arch -arm64 /usr/bin/env bash")
42+
set(CONDAARCH "osx-arm64")
3743
else()
3844
set(SHEBANG "/usr/bin/env bash")
45+
set(CONDAARCH "osx-64")
3946
endif()
4047
endif()
4148

@@ -56,7 +63,7 @@ set(WORK "${PROJECT_BINARY_DIR}/work")
5663

5764
# Configure the .py launcher
5865
configure_file(Contents/MacOS/mccodegui.py.in ${WORK}/mccodegui @ONLY)
59-
configure_file(Contents/MacOS/Miniforge-inject.command.in ${WORK}/Miniforge-inject.command @ONLY)
66+
configure_file(Contents/MacOS/micromamba-inject.command.in ${WORK}/micromamba-inject.command @ONLY)
6067

6168
execute_process(COMMAND "chmod ARGS 755 work/mccodegui")
6269

@@ -71,7 +78,7 @@ install (
7178
)
7279

7380
install(
74-
FILES "${WORK}/mccodegui" "${WORK}/Miniforge-inject.command"
81+
FILES "${WORK}/mccodegui" "${WORK}/micromamba-inject.command"
7582
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
7683
DESTINATION "Contents/MacOS/"
7784
)

support/MacOSX/McCode-conda.app/Contents/MacOS/Miniforge-inject.command.in

Lines changed: 0 additions & 77 deletions
This file was deleted.

support/MacOSX/McCode-conda.app/Contents/MacOS/mccodegui.py.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ then
5353
if [ "$ret_code2" != "0" ]; # Unloading must have failed
5454
then
5555
COND=`which conda`
56-
osascript -e "tell app \"System Events\" to display dialog \"Info: Could not unload your existing conda env ${COND}... :-( Attempting injection by Miniforge anyhow \""
56+
osascript -e "tell app \"System Events\" to display dialog \"Info: Could not unload your existing conda env ${COND}... :-( Attempting injection by micromamba anyhow \""
5757
fi
5858

59-
# Fetch latest Miniforge
59+
# Fetch latest micromamba
6060
touch ${BASEDIR}/Contents/Resources/INJECTING
61-
/usr/bin/open $SCRIPTDIR/Miniforge-inject.command
61+
/usr/bin/open $SCRIPTDIR/micromamba-inject.command
6262
export INJECTING=1
6363
fi
6464
fi
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!@SHEBANG@ --login
2+
#
3+
# Script for downloading and injecting dependencies using a fresh micromamba
4+
#
5+
6+
BASEDIR=`dirname $0`
7+
BASEDIR=$BASEDIR/../..
8+
9+
osascript -e "tell app \"System Events\" to display dialog \"Will download inject dependencies using latest micromamba :-) \""
10+
ret_code0=$?
11+
12+
if [ "$ret_code0" != "0" ];
13+
then
14+
echo "User cancelled..."
15+
rm ${BASEDIR}/Contents/Resources/INJECTING
16+
exit
17+
else
18+
(cd /tmp && curl -L -O https://raw.githubusercontent.com/mccode-dev/McCode/main/@FLAVOR@-environment.yml)
19+
ret_code1=$?
20+
if [ "$ret_code1" != "0" ];
21+
then
22+
osascript -e "tell app \"System Events\" to display dialog \"Error: Failure occured during download of @FLAVOR@-environment.yml... :-( \""
23+
else
24+
(cd /tmp && curl -Ls https://micro.mamba.pm/api/micromamba/@CONDAARCH@/latest | tar -xvj bin/micromamba)
25+
ret_code2=$?
26+
if [ "$ret_code2" != "0" ];
27+
then
28+
osascript -e "tell app \"System Events\" to display dialog \"Error: Failure occured during download of micromamba installer... :-( \""
29+
else
30+
/tmp/bin/micromamba create -p ${BASEDIR}/Contents/Resources/miniconda3/ --file /tmp/@FLAVOR@-environment.yml -y
31+
ret_code3=$?
32+
if [ "$ret_code3" != "0" ];
33+
then
34+
osascript -e "tell app \"System Events\" to display dialog \"Error: Failure during execution of micromamba installer... :-( \""
35+
else
36+
MCCONDADIR=`dirname $(readlink -f ${BASEDIR}/Contents/Resources/miniconda3/bin)`
37+
echo source $MCCONDADIR/bin/activate
38+
source $MCCONDADIR/bin/activate
39+
ret_code4=$?
40+
if [ "$ret_code4" != "0" ];
41+
then
42+
osascript -e "tell app \"System Events\" to display dialog \"Error: Failure activating micromamba env... :-( \""
43+
else
44+
@GUIPREFIX@doc -i
45+
ret_code7=$?
46+
if [ "$ret_code7" != "0" ];
47+
then
48+
osascript -e "tell app \"System Events\" to display dialog \"Error during @GUIPREFIX@doc -i step... :-( \""
49+
else
50+
osascript -e "tell app \"System Events\" to display dialog \"Your @FLAVOR@ should now contain the necessary dependencies! :-) \""
51+
rm ${BASEDIR}/Contents/Resources/INJECTING
52+
fi
53+
fi
54+
fi
55+
fi
56+
fi
57+
fi

0 commit comments

Comments
 (0)