So far, in all Makefiles we have a complicated way to construct PKGDIR path which is used to install python modules into. Firstly, python version is obtained, and then system prefix and these are then used to construct the PKGDIR path. Well, we can do better. We can use 'site.getsitepackages()[0]' to obtain exactly the path we are after. This also fixes the problem on distributions which have split /usr/lib and /usr/lib64 directories, because with the way we are constructing the PKGDIR path we assume that the directories are the same (or one is a symlink to another). Well, that is not always the case. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
25 lines
595 B
Makefile
25 lines
595 B
Makefile
PYFILES = $(wildcard *.py)
|
|
|
|
PACKAGE = $(shell basename `pwd`)
|
|
PKGDIR = $(shell $(PYTHON) -c "import site; print(site.getsitepackages()[0])")/$(PACKAGE)
|
|
|
|
_default:
|
|
@echo "nothing to make. try make install"
|
|
|
|
clean:
|
|
rm -f *.o *.so *.pyc *~
|
|
rm -rf __pycache__
|
|
|
|
install:
|
|
@if [ "$(DESTDIR)" = "" ]; then \
|
|
echo " "; \
|
|
echo "ERROR: A destdir is required"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
mkdir -p $(DESTDIR)/$(PKGDIR)
|
|
for p in $(PYFILES) ; do \
|
|
install -p -m 644 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
|
|
done
|
|
|
|
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
|