diff --git a/cli/Makefile b/cli/Makefile index 122a23fc..53814c29 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -1,7 +1,7 @@ SUBDIRS=koji_cli PACKAGE = $(shell basename `pwd`) -PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE) +PKGDIR = $(shell $(PYTHON) ../devtools/get_site_packages.py )/$(PACKAGE) FILES = koji diff --git a/cli/koji_cli/Makefile b/cli/koji_cli/Makefile index 62b8b53e..d73d17e2 100644 --- a/cli/koji_cli/Makefile +++ b/cli/koji_cli/Makefile @@ -1,7 +1,7 @@ PYFILES = $(wildcard *.py) PACKAGE = $(shell basename `pwd`) -PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE) +PKGDIR = $(shell $(PYTHON) ../../devtools/get_site_packages.py )/$(PACKAGE) _default: @echo "nothing to make. try make install" diff --git a/devtools/get_site_packages.py b/devtools/get_site_packages.py new file mode 100644 index 00000000..ab2fad03 --- /dev/null +++ b/devtools/get_site_packages.py @@ -0,0 +1,8 @@ +# prints site-packages path for use in Makefiles + +try: + from distutils.sysconfig import get_python_lib + print(get_python_lib()) +except ImportError: + import sysconfig + print(sysconfig.get_path('purelib', 'rpm_prefix')) diff --git a/koji/Makefile b/koji/Makefile index b1dda3c4..2e6a2060 100644 --- a/koji/Makefile +++ b/koji/Makefile @@ -3,7 +3,7 @@ PACKAGE = $(shell basename `pwd`) PYFILES_ALL = $(wildcard *.py) PYSCRIPTS = SUBDIRS = -PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE) +PKGDIR = $(shell $(PYTHON) ../devtools/get_site_packages.py )/$(PACKAGE) ifeq ($(PYVER_MAJOR),2) PYFILES=$(filter-out db.py,$(PYFILES_ALL)) diff --git a/kojihub/Makefile b/kojihub/Makefile index db9310aa..b387bb51 100644 --- a/kojihub/Makefile +++ b/kojihub/Makefile @@ -1,7 +1,7 @@ PYVER_MAJOR := $(shell $(PYTHON) -c 'import sys; print(".".join(sys.version.split(".")[:1]))') PACKAGE = kojihub PYFILES = $(wildcard *.py) -PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE) +PKGDIR = $(shell $(PYTHON) ../devtools/get_site_packages.py )/$(PACKAGE) SERVERDIR = /usr/share/koji-hub diff --git a/plugins/Makefile b/plugins/Makefile index 50fd89fe..ca46f2a4 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -1,5 +1,5 @@ PYVER_MAJOR := $(shell $(PYTHON) -c 'import sys; print(".".join(sys.version.split(".")[:1]))') -PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE) +PKGDIR = $(shell $(PYTHON) ../devtools/get_site_packages.py )/$(PACKAGE) CLIPLUGINDIR = $(PKGDIR)/koji_cli_plugins HUBPLUGINDIR = /usr/lib/koji-hub-plugins diff --git a/www/lib/kojiweb/Makefile b/www/lib/kojiweb/Makefile index 5fa67c07..892e961f 100644 --- a/www/lib/kojiweb/Makefile +++ b/www/lib/kojiweb/Makefile @@ -1,6 +1,6 @@ PACKAGE = $(shell basename `pwd`) PYFILES = $(wildcard *.py) -PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE) +PKGDIR = $(shell $(PYTHON) ../../devtools/get_site_packages.py )/$(PACKAGE) SERVERDIR = /kojiweb FILES = $(wildcard *.py *.chtml)