#!/bin/bash echo "Loading Bernina Python (pixi)" # <<< conda initialize <<< # Prefer the local per-host pixi mirror in ~/bpy (see pixi_local_sync.sh) # over the shared NFS install, for speed -- but only once verified # identical: pixi.lock fully determines what gets built (see chat), so a # byte-for-byte match against the shared lock means the local bpy312 is # guaranteed the same as what bpy-default.sh below would give you. # Anything else (no local copy yet, a sync in progress, or behind) falls # back to the existing shared-NFS activation, unchanged. # # The lock match alone isn't enough though: pixi_local_sync.sh copies # pixi.lock BEFORE it finishes (re)installing bpy312/bin, so there's a # window where the lock already matches but the env on disk is still # being rewritten. Guard against that with a non-blocking SHARED flock # on the same lock file that script holds EXCLUSIVELY during that whole # window -- if we can't get it, a sync is actively running right now, so # fall back rather than risk activating a half-linked env. _bpy_local="$HOME/bpy" _bpy_activated=0 if [ -d "$_bpy_local/.pixi_local_sync" ]; then exec 8>"$_bpy_local/.pixi_local_sync/.install.lock" if flock -s -n 8; then if cmp -s "$_bpy_local/pixi.lock" /sf/bernina/applications/python/pixi.lock 2>/dev/null \ && [ -d "$_bpy_local/.pixi/envs/bpy312/bin" ]; then eval "$(/sf/bernina/bin/pixi shell-hook -e bpy312 -s bash -m "$_bpy_local/pixi.toml")" _bpy_activated=1 fi flock -u 8 fi exec 8>&- fi [ "$_bpy_activated" -eq 1 ] || source /sf/bernina/bin/bpy-default.sh unset _bpy_local _bpy_activated micromamba config append envs_dirs /sf/bernina/applications/python/environments