From ecd43ab512e707f6e7873368871b517ed3206859 Mon Sep 17 00:00:00 2001 From: Ryan Carsten Schmidt Date: Fri, 26 Apr 2024 02:35:13 +0000 Subject: [PATCH] install python modules to purelib and platlib Don't assume that python modules go into $(libdir)/$$ver/site-packages; get the correct values by asking sysconfig for its platlib and purelib. This requires python 2.7 or later or python 3.2 or later. --- Makefile.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 7534abe..1741ee7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -161,10 +161,15 @@ endif install-py: _snack.$(SOEXT) ifneq ($(PYTHONVERS),) - for ver in $(PYTHONVERS); do \ - [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\ - install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$(libdir)/$$ver/site-packages ;\ - install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\ + @for ver in $(PYTHONVERS); do \ + PLATLIB=`$$ver -c "import sysconfig; print(sysconfig.get_path('platlib'))"`; \ + PURELIB=`$$ver -c "import sysconfig; print(sysconfig.get_path('purelib'))"`; \ + [ -d $(instroot)/$$PLATLIB ] || install -m 755 -d $(instroot)/$$PLATLIB ;\ + [ -d $(instroot)/$$PURELIB ] || install -m 755 -d $(instroot)/$$PURELIB ;\ + echo install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$$PLATLIB;\ + install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$$PLATLIB;\ + echo install -m 644 snack.py $(instroot)/$$PURELIB;\ + install -m 644 snack.py $(instroot)/$$PURELIB;\ done endif -- 2.39.5