-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
486d68e
commit 11a6188
Showing
2 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Adapted from https://raw.githubusercontent.com/mamba-org/micromamba-releases/main/install.ps1 | ||
|
||
$CNAPY_VERSION = "1.2.1.1" # Replace with the actual version if needed | ||
$RELEASE_URL="https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-win-64" | ||
|
||
Write-Output "Downloading micromamba from $RELEASE_URL" | ||
curl.exe -L -o micromamba.exe $RELEASE_URL | ||
|
||
# Get the directory where the script is located | ||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
|
||
$InstallDir = Join-Path -Path $ScriptDir -ChildPath "cnapy-$CNAPY_VERSION" | ||
New-Item -ItemType Directory -Force -Path $InstallDir | out-null | ||
|
||
$MAMBA_INSTALL_PATH = Join-Path -Path $InstallDir -ChildPath "micromamba.exe" | ||
|
||
Write-Output "`nInstalling micromamba to $InstallDir`n" | ||
Move-Item -Force micromamba.exe $MAMBA_INSTALL_PATH | out-null | ||
|
||
# Use & to execute the micromamba commands stored in the variable | ||
& $MAMBA_INSTALL_PATH create -y -p "./cnapy-$CNAPY_VERSION/cnapy-environment" python=3.10 pip -r "./cnapy-$CNAPY_VERSION/" | ||
& $MAMBA_INSTALL_PATH run -p "./cnapy-$CNAPY_VERSION/cnapy-environment" -r "./cnapy-$CNAPY_VERSION/" pip install --no-cache-dir uv | ||
& $MAMBA_INSTALL_PATH run -p "./cnapy-$CNAPY_VERSION/cnapy-environment" -r "./cnapy-$CNAPY_VERSION/" uv --no-cache pip install --no-cache-dir cnapy | ||
|
||
# Create a new batch file called "RUN_CNApy.bat" | ||
$BatchFilePath = Join-Path -Path $InstallDir -ChildPath "RUN_CNApy.bat" | ||
$BatchFileContent = "@echo off`n" + "& `"$MAMBA_INSTALL_PATH`" run -p `".\cnapy-$CNAPY_VERSION\cnapy-environment`" -r `".\cnapy-$CNAPY_VERSION\`" cnapy" | ||
Set-Content -Path $BatchFilePath -Value $BatchFileContent | ||
|
||
# Create desktop icon using PowerShell | ||
$ShortcutPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Desktop", "CNApy-$CNAPY_VERSION.lnk") | ||
$WScriptShell = New-Object -ComObject WScript.Shell | ||
$Shortcut = $WScriptShell.CreateShortcut($ShortcutPath) | ||
$Shortcut.TargetPath = $BatchFilePath | ||
# $Shortcut.IconLocation = Join-Path -Path $ScriptDir -ChildPath "icon\CNApy_Icon.ico" | ||
$Shortcut.WorkingDirectory = $ScriptDir | ||
$Shortcut.Save() | ||
|
||
Write-Output "`nDesktop shortcut created successfully`n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/sh | ||
# Adapted from https://raw.githubusercontent.com/mamba-org/micromamba-releases/main/install.sh | ||
|
||
set -eu | ||
|
||
# CNApy version | ||
CNAPY_VERSION="1.2.1.1" | ||
|
||
# Folders | ||
BIN_FOLDER="${BIN_FOLDER:-./cnapy-${CNAPY_VERSION}}" | ||
CONDA_FORGE_YES="${CONDA_FORGE_YES:-yes}" | ||
|
||
# Computing artifact location | ||
case "$(uname)" in | ||
Linux) | ||
PLATFORM="linux" ;; | ||
Darwin) | ||
PLATFORM="osx" ;; | ||
*NT*) | ||
PLATFORM="win" ;; | ||
esac | ||
|
||
ARCH="$(uname -m)" | ||
case "$ARCH" in | ||
aarch64|ppc64le|arm64) | ||
;; # pass | ||
*) | ||
ARCH="64" ;; | ||
esac | ||
|
||
case "$PLATFORM-$ARCH" in | ||
linux-aarch64|linux-ppc64le|linux-64|osx-arm64|osx-64|win-64) | ||
;; # pass | ||
*) | ||
echo "Failed to detect your operating system. This installer only supports linux-aarch64|linux-ppc64le|linux-64|osx-arm64|osx-64|win-64" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
RELEASE_URL="https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-${PLATFORM}-${ARCH}" | ||
|
||
# Downloading artifact | ||
mkdir -p "${BIN_FOLDER}" | ||
if hash curl >/dev/null 2>&1; then | ||
curl "${RELEASE_URL}" -o "${BIN_FOLDER}/micromamba" -fsSL --compressed ${CURL_OPTS:-} | ||
elif hash wget >/dev/null 2>&1; then | ||
wget ${WGET_OPTS:-} -qO "${BIN_FOLDER}/micromamba" "${RELEASE_URL}" | ||
else | ||
echo "Neither curl nor wget was found. Please install one of them on your system." >&2 | ||
exit 1 | ||
fi | ||
chmod +x "${BIN_FOLDER}/micromamba" | ||
|
||
./cnapy-${CNAPY_VERSION}/micromamba create -y -p ./cnapy-${CNAPY_VERSION}/cnapy-environment python=3.10 pip -r ./cnapy-${CNAPY_VERSION}/ | ||
./cnapy-${CNAPY_VERSION}/micromamba run -p ./cnapy-${CNAPY_VERSION}/cnapy-environment -r ./cnapy-${CNAPY_VERSION}/ pip install --no-cache-dir uv | ||
./cnapy-${CNAPY_VERSION}/micromamba run -p ./cnapy-${CNAPY_VERSION}/cnapy-environment -r ./cnapy-${CNAPY_VERSION}/ uv --no-cache pip install --no-cache-dir cnapy | ||
|
||
cat << 'EOF' > run_cnapy.sh | ||
#!/bin/bash | ||
./cnapy-${CNAPY_VERSION}/micromamba run -p ./cnapy-${CNAPY_VERSION}/cnapy-environment -r ./cnapy-${CNAPY_VERSION}/ cnapy | ||
EOF | ||
|
||
# Make the shell script executable | ||
chmod +x run_cnapy.sh |