mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[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.
This commit is contained in:
@@ -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']
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user