[PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Debian the `distutils` module is patched, so `get_python_lib()` returns by default `/usr/lib/python3/dist-packages` (no minor version).

But `setuptools` affecting setup.py is not patched to create the library directory at `/usr/lib/python3/dist-packages` by default, rather than a command line argument `--install-layout deb` is added.

Add PYTON_SETUP_ARGS as argument to affected setup.py calls and add a note in the global ReadMe.

See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html section B.1.

Fixes: https://github.com/SELinuxProject/selinux/issues/187
---
v2:
  Use env variable PYTON_SETUP_ARGS instead of internal detection logic

 README.md                | 2 ++
 libselinux/src/Makefile  | 2 +-
 python/sepolicy/Makefile | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 974280f9..3c97a5a3 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,8 @@ To build and install everything under a private directory, run:
 
     make DESTDIR=~/obj install install-pywrap
 
+Note: On Debian `PYTON_SETUP_ARGS=--install-layout=deb` needs to be set in order to create the correct python directory structure.
+
 To install as the default system libraries and binaries
 (overwriting any previously installed ones - dangerous!),
 on x86_64, run:
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 73303c36..bccc852d 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -174,7 +174,7 @@ install: all
 	ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
 
 install-pywrap: pywrap
-	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
+	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTON_SETUP_ARGS)
 	install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
 	ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
 
diff --git a/python/sepolicy/Makefile b/python/sepolicy/Makefile
index 69f29fa9..4ad0d4dc 100644
--- a/python/sepolicy/Makefile
+++ b/python/sepolicy/Makefile
@@ -27,7 +27,7 @@ test:
 	@$(PYTHON) test_sepolicy.py -v
 
 install:
-	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
+	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTON_SETUP_ARGS)
 	[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
 	install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
 	(cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
-- 
2.26.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux