From 20065e88a0ed64906169e9d95b1751efab8e8dd7 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 24 Jul 2025 18:46:39 +0200 Subject: [PATCH] (Hopefully) Optimized python venv integration. If it leads to bugs, you know wehere to find them. --- Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8e893e7..2f4c1e3 100644 --- a/Makefile +++ b/Makefile @@ -14,17 +14,14 @@ install: @echo "Ensuring ~/.bashrc exists..." @test -f ~/.bashrc || touch ~/.bashrc @echo "Ensuring automatic activation of ~/.venvs/pkgmgr for this user..." - @grep -qxF 'if [ -d "$$HOME/.venvs/pkgmgr" ]; then export VIRTUAL_ENV="$$HOME/.venvs/pkgmgr"; export PATH="$$VIRTUAL_ENV/bin:$$PATH"; unset PYTHONHOME; fi' ~/.bashrc \ - || echo 'if [ -d "$$HOME/.venvs/pkgmgr" ]; then export VIRTUAL_ENV="$$HOME/.venvs/pkgmgr"; export PATH="$$VIRTUAL_ENV/bin:$$PATH"; unset PYTHONHOME; fi' >> ~/.bashrc - @grep -qxF 'echo "Global Python virtual environment '\''~/.venvs/pkgmgr'\'' activated."' ~/.bashrc \ - || echo 'echo "Global Python virtual environment '\''~/.venvs/pkgmgr'\'' activated."' >> ~/.bashrc + @grep -qxF 'if [ -d "$$HOME/.venvs/pkgmgr" ]; then . "$$HOME/.venvs/pkgmgr/bin/activate"; echo "Global Python virtual environment '\''~/.venvs/pkgmgr'\'' activated."; fi' ~/.bashrc \ + || echo 'if [ -d "$$HOME/.venvs/pkgmgr" ]; then . "$$HOME/.venvs/pkgmgr/bin/activate"; echo "Global Python virtual environment '\''~/.venvs/pkgmgr'\'' activated."; fi' >> ~/.bashrc @echo "Installation complete. Please restart your shell (or 'exec bash') for the changes to take effect." uninstall: @echo "Removing global user virtual environment if it exists..." @rm -rf ~/.venvs/pkgmgr @echo "Cleaning up ~/.bashrc entries..." - @sed -i '/Global Python virtual environment '\''~\/.venvs\/pkgmgr'\'' activated\./d' ~/.bashrc - @sed -i '/if \[ -d "\$\$HOME\/\.venvs\/pkgmgr" \]; then export VIRTUAL_ENV="\$\$HOME\/\.venvs\/pkgmgr"; export PATH="\$\$VIRTUAL_ENV\/bin:\$\$PATH"; unset PYTHONHOME; fi/d' ~/.bashrc + @sed -i '/if \[ -d "\$\$HOME\/\.venvs\/pkgmgr" \]; then \. "\$\$HOME\/\.venvs\/pkgmgr\/bin\/activate"; echo "Global Python virtual environment '\\''~\/.venvs\/pkgmgr'\\'' activated."; fi/d' ~/.bashrc @echo "Uninstallation complete. Please restart your shell (or 'exec bash') for the changes to fully apply."