From 25aeff76adc19474e5884ee2fe667b9bca5d49e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Wed, 23 Aug 2017 11:50:01 +0200 Subject: [PATCH] [v9_10] Add --with-python-install-dir configure option 4698. [port] Add --with-python-install-dir configure option to allow specifying a nonstandard installation directory for Python modules. [RT #45407] (cherry picked from commit a5dc1bc395ef514cb8320cc1c30d764c93f01649) --- CHANGES | 4 ++++ bin/python/Makefile.in | 4 ++-- bin/python/dnssec-checkds.py.in | 7 +++++-- bin/python/dnssec-coverage.py.in | 7 +++++-- configure.in | 19 ++++++++++++++++++- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index a04b344e4e..02569ded16 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +4698. [port] Add --with-python-install-dir configure option to allow + specifying a nonstandard installation directory for + Python modules. [RT #45407] + 4696. [port] Enable filter-aaaa support by default on Windows builds. [RT #45883] diff --git a/bin/python/Makefile.in b/bin/python/Makefile.in index 15e3b36f99..45a87bfefa 100644 --- a/bin/python/Makefile.in +++ b/bin/python/Makefile.in @@ -55,9 +55,9 @@ install:: ${TARGETS} installdirs ${INSTALL_DATA} ${srcdir}/dnssec-coverage.8 ${DESTDIR}${mandir}/man8 if test -n "${PYTHON}" ; then \ if test -n "${DESTDIR}" ; then \ - ${PYTHON} ${srcdir}/setup.py install --root=${DESTDIR} --prefix=${prefix} ; \ + ${PYTHON} ${srcdir}/setup.py install --root=${DESTDIR} --prefix=${prefix} @PYTHON_INSTALL_LIB@ ; \ else \ - ${PYTHON} ${srcdir}/setup.py install --prefix=${prefix} ; \ + ${PYTHON} ${srcdir}/setup.py install --prefix=${prefix} @PYTHON_INSTALL_LIB@ ; \ fi ; \ rm -rf build ; \ fi diff --git a/bin/python/dnssec-checkds.py.in b/bin/python/dnssec-checkds.py.in index bfc3c4cb0c..e6ac3522fe 100644 --- a/bin/python/dnssec-checkds.py.in +++ b/bin/python/dnssec-checkds.py.in @@ -20,8 +20,11 @@ import sys sys.path.insert(0, os.path.dirname(sys.argv[0])) if os.name != 'nt': - sys.path.insert(1, os.path.join('@prefix@', 'lib', - 'python' + sys.version[:3], 'site-packages')) + if '@PYTHON_INSTALL_DIR@': # value of --with-python-install-dir + sys.path.insert(1, '@PYTHON_INSTALL_DIR@') + else: + sys.path.insert(1, os.path.join('@prefix@', 'lib', + 'python' + sys.version[:3], 'site-packages')) import isc.checkds diff --git a/bin/python/dnssec-coverage.py.in b/bin/python/dnssec-coverage.py.in index 84b69e476d..30efed1e41 100644 --- a/bin/python/dnssec-coverage.py.in +++ b/bin/python/dnssec-coverage.py.in @@ -20,8 +20,11 @@ import sys sys.path.insert(0, os.path.dirname(sys.argv[0])) if os.name != 'nt': - sys.path.insert(1, os.path.join('@prefix@', 'lib', - 'python' + sys.version[:3], 'site-packages')) + if '@PYTHON_INSTALL_DIR@': # value of --with-python-install-dir + sys.path.insert(1, '@PYTHON_INSTALL_DIR@') + else: + sys.path.insert(1, os.path.join('@prefix@', 'lib', + 'python' + sys.version[:3], 'site-packages')) import isc.coverage diff --git a/configure.in b/configure.in index 13d5bb060e..d41d47bdbd 100644 --- a/configure.in +++ b/configure.in @@ -226,6 +226,10 @@ AC_SUBST(PERL) AC_ARG_WITH(python, [ --with-python=PATH specify path to python interpreter], use_python="$withval", use_python="unspec") +AC_ARG_WITH(python-install-dir, + AC_HELP_STRING([--with-python-install-dir=PATH], + [installation directory for Python modules]), + use_python_install_dir="$withval", use_python_install_dir="unspec") python="python python3 python3.5 python3.4 python3.3 python3.2 python2 python2.7" @@ -270,8 +274,19 @@ case "$use_python" in continue fi done - if test "X$PYTHON" = "X" + if test "X$PYTHON" != "X" then + case "$use_python_install_dir" in + unspec) + PYTHON_INSTALL_DIR="" + PYTHON_INSTALL_LIB="" + ;; + *) + PYTHON_INSTALL_DIR="$use_python_install_dir" + PYTHON_INSTALL_LIB="--install-lib=$use_python_install_dir" + ;; + esac + else AC_MSG_CHECKING([for python support]) case "$use_python" in unspec) @@ -320,6 +335,8 @@ fi AC_SUBST(CHECKDS) AC_SUBST(COVERAGE) AC_SUBST(PYTHON_TOOLS) +AC_SUBST(PYTHON_INSTALL_DIR) +AC_SUBST(PYTHON_INSTALL_LIB) # # Special processing of paths depending on whether --prefix,