Skip to content

Commit

Permalink
fix: refactor makefile for better installation compatibility
Browse files Browse the repository at this point in the history
- Update paths to use site.getsitepackages() for dynamic site-packages
  location to improve installation flexibility.

- Add `uninstall` target to remove installed files and clean up
  artifacts.

Fixes marekjm#5
  • Loading branch information
stelewis committed Oct 31, 2023
1 parent 5a097fa commit cc4e92c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PYTHONVERSION=`python3 -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
SITE_PACKAGES_PATH=`python -c "import site; print(site.getsitepackages()[0])"`

.PHONY: tests tests-python2

Expand All @@ -12,12 +13,16 @@ doc:
global-install:
make tests
make clean
mkdir -p $(PREFIX)/lib/python$(PYTHONVERSION)/site-packages/clap
cp -v ./clap/*.py $(PREFIX)/lib/python$(PYTHONVERSION)/site-packages/clap/
mkdir $(SITE_PACKAGES_PATH)/clap
cp -v ./clap/*.py $(SITE_PACKAGES_PATH)/clap/

install: ./clap/*.py
mkdir -p ~/.local/lib/python$(PYTHONVERSION)/site-packages/clap
cp -v ./clap/*.py ~/.local/lib/python$(PYTHONVERSION)/site-packages/clap/
mkdir $(SITE_PACKAGES_PATH)/clap
cp -v ./clap/*.py $(SITE_PACKAGES_PATH)/clap/

uninstall:
rm -rf $(SITE_PACKAGES_PATH)/clap
make clean

clean:
rm -rf ./clap/__pycache__
Expand Down

0 comments on commit cc4e92c

Please sign in to comment.