Files
pkgmgr/Makefile

32 lines
1.5 KiB
Makefile
Raw Normal View History

2025-08-08 09:38:18 +02:00
.PHONY: install setup uninstall
2025-04-01 15:37:07 +02:00
setup: install
@python main.py install
install:
@echo "Making 'main.py' executable..."
@chmod +x main.py
2025-04-27 22:38:52 +02:00
@echo "Checking if global user virtual environment exists..."
2025-08-08 09:38:18 +02:00
@mkdir -p ~/.venvs/pkgmgr
2025-04-27 22:38:52 +02:00
@test -d ~/.venvs/pkgmgr || (echo "Creating global venv at ~/.venvs/pkgmgr..." && python -m venv ~/.venvs/pkgmgr)
@echo "Installing required Python packages into ~/.venvs/pkgmgr..."
@~/.venvs/pkgmgr/bin/pip install --upgrade pip
@~/.venvs/pkgmgr/bin/pip install -r requirements.txt
2025-08-08 09:38:18 +02:00
@echo "Ensuring ~/.bashrc and ~/.zshrc exist..."
@touch ~/.bashrc ~/.zshrc
2025-04-27 22:38:52 +02:00
@echo "Ensuring automatic activation of ~/.venvs/pkgmgr for this user..."
2025-08-08 09:38:18 +02:00
@for rc in ~/.bashrc ~/.zshrc; do \
rc_line='if [ -d "$${HOME}/.venvs/pkgmgr" ]; then . "$${HOME}/.venvs/pkgmgr/bin/activate"; echo "Global Python virtual environment '\''~/.venvs/pkgmgr'\'' activated."; fi'; \
grep -qxF "$${rc_line}" $$rc || echo "$${rc_line}" >> $$rc; \
done
@echo "Installation complete. Please restart your shell (or 'exec bash' or 'exec zsh') for the changes to take effect."
2025-04-27 22:38:52 +02:00
uninstall:
@echo "Removing global user virtual environment if it exists..."
@rm -rf ~/.venvs/pkgmgr
2025-08-08 09:38:18 +02:00
@echo "Cleaning up ~/.bashrc and ~/.zshrc entries..."
@for rc in ~/.bashrc ~/.zshrc; do \
sed -i '/\.venvs\/pkgmgr\/bin\/activate"; echo "Global Python virtual environment '\''~\/\.venvs\/pkgmgr'\'' activated."; fi/d' $$rc; \
done
@echo "Uninstallation complete. Please restart your shell (or 'exec bash' or 'exec zsh') for the changes to fully apply."