Two cache layers kept resurrecting a pure-python wheel without _cmd.so: - modbuild -f re-untars over the old src dir, leaving a stale build/ tree from a half-failed compile; setup.py packs it as-is - uv's built-wheel cache (in UV_CACHE_DIR, not ~/.cache/uv) then serves that wheel on every rebuild (Prepared in ~550ms = no compile) rm -rf $SRC_DIR/build in configure + --no-cache on the pymol install kill both permanently. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
59 lines
3.1 KiB
Python
Executable File
59 lines
3.1 KiB
Python
Executable File
#!/usr/bin/env modbuild
|
|
|
|
# Open-source PyMOL, compiled from the GitHub source tarball into a uv venv
|
|
# (careless-style uv route; conda unreachable from Ra). Default pbuild::prep
|
|
# downloads + sha-verifies + unpacks both urls from files/config.yaml.
|
|
# GLEW/libpng/freetype/GL headers must exist as system RPMs on the build host;
|
|
# msgpack/MMTF, libxml2 (COLLADA) and VMD plugins (libnetcdf) are disabled
|
|
# because those libs are not on Ra.
|
|
|
|
pbuild::configure() {
|
|
# modbuild's shell strips ~/.local/bin from PATH; override with UV=/path/to/uv if needed
|
|
UV="${UV:-$HOME/.local/bin/uv}"
|
|
# ~/.cache/uv hits the home disk quota; shared cache reuses wheels across MX builds
|
|
export UV_CACHE_DIR="/opt/psi/MX/.uv-cache"
|
|
# keep the standalone CPython inside PREFIX so venv symlinks never point at a home cache
|
|
export UV_PYTHON_INSTALL_DIR="$PREFIX/python"
|
|
"$UV" venv --python 3.12 "$PREFIX/venv" || std::die 42 "uv venv failed - is uv at \$UV?"
|
|
|
|
# modbuild -f re-untars over the old src dir without deleting extras; a stale
|
|
# setuptools build/ tree from a failed run then gets packed into the wheel as-is
|
|
# (pure-python, no _cmd.so). Wipe it so every build compiles from scratch.
|
|
rm -rf "$SRC_DIR/build"
|
|
|
|
# stage glm where setup.py's PREFIX_PATH lookup expects it: <prefix>/include/glm.
|
|
# strip_dirs applies to the glm tarball too, so headers land at $SRC_DIR/glm directly
|
|
mkdir -p "$SRC_DIR/deps/include"
|
|
cp -r "$SRC_DIR/glm" "$SRC_DIR/deps/include/" || \
|
|
std::die 42 "glm staging failed - glm tarball missing from SRC_DIR?"
|
|
}
|
|
|
|
pbuild::compile() {
|
|
:
|
|
}
|
|
|
|
pbuild::install() {
|
|
UV="${UV:-$HOME/.local/bin/uv}"
|
|
export UV_CACHE_DIR="/opt/psi/MX/.uv-cache"
|
|
# force the gcc module's compilers; uv's standalone CPython records clang in sysconfig
|
|
export CC=gcc CXX=g++
|
|
export PREFIX_PATH="$SRC_DIR/deps"
|
|
# -C k=v reaches setup.py as `build_ext --k=v` (_custom_build/backend.py).
|
|
# str2bool accepts ONLY true/false (yes/no -> "Boolean value expected").
|
|
# no-vmd-plugins=false is deliberate: upstream dest is vmd_plugins, false disables them.
|
|
# --no-cache: never reuse a cached pymol wheel — a poisoned pure-python wheel
|
|
# (built from a half-failed compile) otherwise gets reinstalled forever
|
|
"$UV" pip install --no-cache --python "$PREFIX/venv/bin/python" \
|
|
-C use-msgpackc=no -C no-libxml=true -C no-vmd-plugins=false \
|
|
"$SRC_DIR" || \
|
|
std::die 42 "pymol build failed - check system devel RPMs (glew, libpng, freetype, mesa-libGL)"
|
|
# Qt GUI; without it pymol falls back to CLI-only
|
|
"$UV" pip install --python "$PREFIX/venv/bin/python" PyQt5 || \
|
|
std::die 42 "PyQt5 install failed"
|
|
[[ -x "$PREFIX/venv/bin/pymol" ]] || std::die 42 "pymol launcher missing from venv"
|
|
# launcher can exist while the compiled ext is missing (pure-python wheel from a
|
|
# poisoned uv cache); import _cmd directly so a broken build dies here, not at runtime
|
|
"$PREFIX/venv/bin/python" -c "import pymol._cmd" || \
|
|
std::die 42 "pymol._cmd import failed - ext .so missing; try 'uv cache clean pymol' (dist name is pymol, not pymol-open-source) and rebuild"
|
|
}
|