Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/make_installers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
id: version
shell: pwsh
run: |
$v = & "bundle\venv\Scripts\python.exe" `
$v = & "bundle\python\python.exe" `
-c "import importlib.metadata; print(importlib.metadata.version('python-microscopy'))"
"version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

Expand Down
34 changes: 17 additions & 17 deletions installers/install-python-microscopy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,28 @@ if not errorlevel 1 (
if errorlevel 1 exit /b 1
)

:: ---- Managed Python + virtual environment ----
echo Installing Python !TARGET_PYTHON!...
"!UV!" python install !TARGET_PYTHON!
if errorlevel 1 (echo ERROR: uv python install failed & exit /b 1)
:: ---- Standalone Python installation via py-app-standalone ----
echo Creating standalone Python installation...
"!UV!" tool run py-app-standalone --python-version !TARGET_PYTHON! --target "!DEST!" --force !PACKAGE_NAME!
if errorlevel 1 (echo ERROR: py-app-standalone failed & exit /b 1)

echo Creating virtual environment...
"!UV!" venv --python !TARGET_PYTHON! "!DEST!\venv"
if errorlevel 1 (echo ERROR: venv creation failed & exit /b 1)

:: ---- Install PYME from pip ----
echo Installing !PACKAGE_NAME!...
"!UV!" pip install --python "!DEST!\venv\Scripts\python.exe" !PACKAGE_NAME!
if errorlevel 1 (echo ERROR: package installation failed & exit /b 1)
:: ---- Normalize cpython-* to a stable directory name ----
:: pushd+ren avoids the CMD quirk where a quoted glob isn't expanded in for /d.
pushd "!DEST!"
for /d %%d in (cpython-*) do ren "%%d" python
popd
if not exist "!DEST!\python\" (echo ERROR: standalone Python directory not found & exit /b 1)
:: Remove the bare-venv temp directory that py-app-standalone leaves behind.
if exist "!DEST!\bare-venv\" rd /s /q "!DEST!\bare-venv"

:: ---- Entry point .cmd wrappers ----
for %%e in (%ENTRY_POINTS%) do call :mk_wrapper "%%e"

:: ---- Activated-console helper ----
:: ---- Console helper (adds python dir to PATH for the session) ----
(
echo @echo off
echo start cmd.exe /k "%%~dp0venv\Scripts\activate.bat"
echo set "PATH=%%~dp0python;%%~dp0python\Scripts;%%PATH%%"
echo cmd.exe /k
) > "!DEST!\pyme-console.cmd"

echo.
Expand Down Expand Up @@ -72,11 +73,10 @@ exit /b 0

:: ----------------------------------------------------------------
:mk_wrapper
:: Writes a thin .cmd shim that forwards all arguments to the venv entry point exe.
:: Uses %~dp0 so wrappers work even if the install folder is moved.
:: Uses %~dp0 so wrappers stay valid if the install folder is moved.
set "_EP=%~1"
(
echo @echo off
echo "%%~dp0venv\Scripts\!_EP!.exe" %%*
echo "%%~dp0python\Scripts\!_EP!.exe" %%*
) > "!DEST!\!_EP!.cmd"
exit /b 0
23 changes: 12 additions & 11 deletions installers/install-python-microscopy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,27 @@ if ! command -v uv &>/dev/null; then
fi
fi

# --- Managed Python ---
uv python install "$TARGET_PYTHON"
# --- Standalone Python installation via py-app-standalone ---
echo "==> Creating standalone Python installation..."
uv tool run py-app-standalone --python-version "$TARGET_PYTHON" --target "$DEST" --force "$PACKAGE_NAME"

# --- Virtual environment ---
uv venv --python "$TARGET_PYTHON" "$DEST/venv"

# --- Install PYME from pip ---
echo "==> Installing $PACKAGE_NAME..."
uv pip install --python "$DEST/venv/bin/python" "$PACKAGE_NAME"
# --- Normalize cpython-* to a stable directory name ---
PYTHON_DIRS=( "$DEST"/cpython-* )
[[ -d "${PYTHON_DIRS[0]}" ]] || { echo "ERROR: standalone Python directory not found" >&2; exit 1; }
mv "${PYTHON_DIRS[0]}" "$DEST/python"
# Remove the bare-venv temp directory that py-app-standalone leaves behind.
rm -rf "$DEST/bare-venv"

# --- Top-level entry point symlinks ---
for ep in "${ENTRY_POINTS[@]}"; do
ln -sf "$DEST/venv/bin/$ep" "$DEST/$ep"
ln -sf "$DEST/python/bin/$ep" "$DEST/$ep"
done

# --- Activated-shell helper ---
# --- Shell helper (adds python/bin to PATH) ---
cat > "$DEST/pyme-shell" <<'SHELL_SCRIPT'
#!/usr/bin/env bash
PYME_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$PYME_DIR/venv/bin/activate"
export PATH="$PYME_DIR/python/bin:$PATH"
exec "${SHELL:-bash}"
SHELL_SCRIPT
chmod +x "$DEST/pyme-shell"
Expand Down
16 changes: 8 additions & 8 deletions installers/windows/pyme_setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@

#define AppName "PYME"
#define AppPublisher "Baddeley Lab, University of Auckland"
; Icons ship with the package inside the venv tree.
; Icons ship with the package inside the standalone Python tree.
; pymeLogo.png has no .ico equivalent — pmanal.ico is used in its place.
#define IconsDir "{app}\venv\Lib\site-packages\PYME\resources\icons"
#define IconsDir "{app}\python\Lib\site-packages\PYME\resources\icons"

[Setup]
; AppId uniquely identifies this application for upgrades and uninstall — do not change.
AppId={{8F3A2E1D-6B4C-4D9F-A7E2-3C1B5F8A2D6E}
AppName={#AppName}
AppVersion={#AppVersion}
AppPublisher={#AppPublisher}
DefaultDirName={autopf}\{#AppName}
DefaultDirName={%USERPROFILE}\PYME
DefaultGroupName={#AppName}
; Per-user install by default; elevation dialog allows all-users install.
PrivilegesRequired=lowest
Expand All @@ -39,9 +39,9 @@ CloseApplications=no
Source: "{#AppSourceDir}\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs

[Icons]
Name: "{group}\PYMEAcquire"; Filename: "{app}\PYMEAcquire.cmd"; IconFilename: "{#IconsDir}\pmacquire.ico"
Name: "{group}\PYMEImage"; Filename: "{app}\PYMEImage.cmd"; IconFilename: "{#IconsDir}\pmanal.ico"
Name: "{group}\PYMEVis"; Filename: "{app}\PYMEVis.cmd"; IconFilename: "{#IconsDir}\pmvis.ico"
Name: "{group}\PYMEClusterOfOne"; Filename: "{app}\PYMEClusterOfOne.cmd"; IconFilename: "{#IconsDir}\pmanal.ico"
Name: "{group}\PYME Console"; Filename: "{app}\pyme-console.cmd"; IconFilename: "{#IconsDir}\pmanal.ico"
Name: "{group}\PYMEAcquire"; Filename: "{app}\python\Scripts\PYMEAcquire.exe"; WorkingDir: "{app}"; IconFilename: "{#IconsDir}\pmacquire.ico"
Name: "{group}\PYMEImage"; Filename: "{app}\python\Scripts\PYMEImage.exe"; WorkingDir: "{app}"; IconFilename: "{#IconsDir}\pmanal.ico"
Name: "{group}\PYMEVis"; Filename: "{app}\python\Scripts\PYMEVis.exe"; WorkingDir: "{app}"; IconFilename: "{#IconsDir}\pmvis.ico"
Name: "{group}\PYMEClusterOfOne"; Filename: "{app}\python\Scripts\PYMEClusterOfOne.exe"; WorkingDir: "{app}"; IconFilename: "{#IconsDir}\pmanal.ico"
Name: "{group}\PYME Console"; Filename: "{sys}\cmd.exe"; Parameters: "/k set ""PATH={app}\python;{app}\python\Scripts;%PATH%"""; WorkingDir: "{%USERPROFILE}"; IconFilename: "{#IconsDir}\pmanal.ico"
Name: "{group}\Uninstall PYME"; Filename: "{uninstallexe}"
Loading