Files
MX_Pmodule/pymol-open-source/build
T

46 lines
2.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?"
# stage glm where setup.py's PREFIX_PATH lookup expects it: <prefix>/include/glm
mkdir -p "$SRC_DIR/deps/include"
cp -r "$SRC_DIR/glm-1.0.1/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).
# no-vmd-plugins=no is deliberate: upstream dest is vmd_plugins, so `no` disables them.
"$UV" pip install --python "$PREFIX/venv/bin/python" \
-C use-msgpackc=no -C no-libxml=yes -C no-vmd-plugins=no \
"$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"
}