From 34225beee3ab9daf09491c87b701eadb3de63f01 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 29 Sep 2024 12:53:34 +0200 Subject: [PATCH] venvs --- re.sh | 54 +++++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/re.sh b/re.sh index 06255ba..2bd90c5 100755 --- a/re.sh +++ b/re.sh @@ -1,6 +1,6 @@ #! /usr/bin/env sh -root="/prj" +root="/prj/venv" url="http://localhost:8000" url_pypi="${url}/pypi/simple" @@ -27,7 +27,10 @@ list() { } pip_install() { echo - pip install --index-url "${url_pypi}" "${@}" + pip install \ + --index-url "${url_pypi}" \ + --no-cache-dir \ + "${@}" } remove() { rm --force --recursive "${@}" @@ -66,7 +69,7 @@ uv_python() { echo export UV_PYTHON_INSTALL_DIR="${1}/cpypy" export UV_PYTHON_INSTALL_MIRROR="${url}/cpypy" - uv python install + uv python install "${2}" unset \ UV_PYTHON_INSTALL_DIR \ UV_PYTHON_INSTALL_MIRROR @@ -80,13 +83,8 @@ uv_venv() { "${1}" } -remove ~/.cache/pip - -os="${root}/venv.os" -py="${root}/venv" - -remove "${os}" "${py}" - +os="${root}/os" +remove "${os}" python3 -m "venv" "${os}" activate "${os}" list "${os}" @@ -94,21 +92,27 @@ pip_install --upgrade "pip" pip_install "uv" list "${os}" -uv_python "${py}" -uv_venv "${py}" +set \ + "3.12" + +for version in "${@}"; do + py="${root}/${version}" + remove "${py}" + uv_python "${py}" "${version}" + uv_venv "${py}" +done deactivate -activate "${py}" - -list "${py}" - -pip_install "uv" - -list "${py}" - -uv_install - -ln --symbolic "/rwx/rwx/rwx" "${py}/lib/python"*"/site-packages/rwx" - -list "${py}" +for version in "${@}"; do + activate "${py}" + list "${py}" + pip_install "uv" + list "${py}" + uv_install + for module in "rwx"; do + ln --symbolic \ + "/rwx/rwx/${module}" \ + "${py}/lib/python${version}/site-packages/${module}" + list "${py}" +done