#! /usr/bin/env sh root="/prj" url="http://localhost:8000" url_pypi="${url}/pypi/simple" activate() { echo export VIRTUAL_ENV="${1}" echo "→ ${VIRTUAL_ENV}" export OLD_PATH="${PATH}" export PATH="${VIRTUAL_ENV}/bin:${PATH}" echo "→ ${PATH}" python3 --version pip --version } deactivate() { echo echo "← ${VIRTUAL_ENV}" export PATH="${OLD_PATH}" echo "← ${PATH}" unset OLD_PATH VIRTUAL_ENV } list() { echo ls -a -l "${1}/bin" } pip_install() { echo pip install --index-url "${url_pypi}" "${@}" } remove() { rm --force --recursive "${@}" } uv_install() { set \ "pelican" \ \ "hatch" \ \ "Sphinx" \ "sphinx-rtd-theme" \ \ "gitlint" \ \ "pydoclint" \ "pylint" \ "ruff" \ \ "pytest" \ \ "toml" \ \ "twine" \ \ "mypy" \ "pyright" \ \ "ruamel.yaml" \ "PyYAML" \ "types-PyYAML" echo uv pip install --index-url "${url_pypi}" "${@}" } uv_python() { echo export UV_PYTHON_INSTALL_DIR="${1}/cpypy" export UV_PYTHON_INSTALL_MIRROR="${url}/cpypy" uv python install unset \ UV_PYTHON_INSTALL_DIR \ UV_PYTHON_INSTALL_MIRROR } uv_venv() { echo uv venv \ --index-url "${url_pypi}" \ --relocatable \ --seed \ "${1}" } remove ~/.cache/pip ~/.local/share/uv os="${root}/venv.os" py="${root}/venv" remove "${os}" "${py}" python3 -m "venv" "${os}" activate "${os}" list "${os}" pip_install --upgrade "pip" pip_install "uv" list "${os}" uv_python "${py}" uv_venv "${py}" deactivate # remove "${os}" activate "${py}" list "${py}" pip_install "uv" list "${py}" uv_install ln --symbolic "/rwx/rwx/rwx" "${py}/lib/python"*"/site-packages/rwx" list "${py}"