diff mbox

[3/4] libsemanage: query for python site-packages dir directly

Message ID 20161114212817.15781-3-nicolas.iooss@m4x.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicolas Iooss Nov. 14, 2016, 9:28 p.m. UTC
Use the python interpreter to find the install directory, like commit
8162f10e670d ("libselinux: query for python site-packages dir directly")
did for libselinux.

While at it, do not install semanage.py (generated by SWIG) with
executable permission bits.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsemanage/src/Makefile | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
index 37d6eabbdae8..5c7bc6c6ea65 100644
--- a/libsemanage/src/Makefile
+++ b/libsemanage/src/Makefile
@@ -12,9 +12,8 @@  PREFIX ?= $(DESTDIR)/usr
 LIBDIR ?= $(PREFIX)/lib
 SHLIBDIR ?= $(DESTDIR)/lib
 INCLUDEDIR ?= $(PREFIX)/include
-PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])')
 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
-PYLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
+PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
 RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] + " -I" + RbConfig::CONFIG["rubyhdrdir"]')
 RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -lruby"')
 RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
@@ -144,9 +143,9 @@  install: all
 	cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
 
 install-pywrap: pywrap 
-	test -d $(PYLIBDIR)/site-packages || install -m 755 -d $(PYLIBDIR)/site-packages
-	install -m 755 $(SWIGSO) $(PYLIBDIR)/site-packages/_semanage.so
-	install -m 755 semanage.py $(PYLIBDIR)/site-packages
+	test -d $(PYSITEDIR) || install -m 755 -d $(PYSITEDIR)
+	install -m 755 $(SWIGSO) $(PYSITEDIR)/_semanage.so
+	install -m 644 semanage.py $(PYSITEDIR)
 
 
 install-rubywrap: rubywrap