From e70e5bf5be5fed767c16a0d59948c856c906ad33 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 29 Jul 2016 15:27:38 -0400 Subject: [PATCH] [SCons] Fix default Python module installation path on Debian/Ubuntu If Cantera is being installed to /usr/local, then on Debian-based distros, we want the Python module to end up in /usr/local/lib/pythonX.Y/dist-packages, which is actually the default behavior. However, /usr/local/... is *not* the default installation prefix for Python modules on some other distros (On Fedora, at least, it's /usr/) so using the default needs to be conditioned on the actual distro. --- SConstruct | 4 ++++ interfaces/cython/SConscript | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 1d9118c69..28dc21460 100644 --- a/SConstruct +++ b/SConstruct @@ -1150,6 +1150,10 @@ if any(name.startswith('/usr/lib64/python') for name in sys.path): else: env['libdirname'] = 'lib' +# On Debian-based systems, need to special-case installation to +# /usr/local because of dist-packages vs site-packages +env['debian'] = any(name.endswith('dist-packages') for name in sys.path) + # Directories where things will be after actually being installed. These # variables are the ones that are used to populate header files, scripts, etc. env['ct_installroot'] = env['prefix'] diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index 4fadc93a6..30125177c 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -81,7 +81,10 @@ def install_module(prefix, python_version): extra += ' --prefix=""' elif prefix: # A specific location for the Cantera python module has been given - if localenv['OS'] == 'Darwin': + if localenv['debian'] and localenv.subst(prefix) == '/usr/local': + # Installation to /usr/local is the default on Debian-based distributions + extra = '' + elif localenv['OS'] == 'Darwin': extra = localenv.subst(' --prefix=${python%s_prefix}' % ver) elif localenv['libdirname'] == 'lib64': # 64-bit RHEL / Fedora