Skip to content

Commit

Permalink
[SCons] Fix default Python module installation path on Debian/Ubuntu
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
speth committed Jul 29, 2016
1 parent dac5345 commit e70e5bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
5 changes: 4 additions & 1 deletion interfaces/cython/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e70e5bf

Please sign in to comment.