Fix substitution of setup_cantera and ctpath.m
Use Python 3 variables by default, and Python 2 only if Python 3 isn't being built
This commit is contained in:
parent
94ea9b585f
commit
2bc4d09da3
3 changed files with 34 additions and 9 deletions
|
|
@ -11,19 +11,31 @@ if env['INSTALL_MANPAGES']:
|
|||
|
||||
### Generate customized scripts ###
|
||||
|
||||
# If any Python 3 package is built, prefer that one. If not,
|
||||
# and if any Python 2 package is built, prefer that one.
|
||||
# In all other cases, use the Python 3 location variables,
|
||||
# which should all be empty strings
|
||||
if env['python3_package'] in ['full', 'minimal']:
|
||||
major = '3'
|
||||
elif env['python2_package'] in ['full', 'minimal']:
|
||||
major = '2'
|
||||
else:
|
||||
major = '3'
|
||||
|
||||
# 'setup_cantera'
|
||||
if localenv['layout'] != 'debian' and env['OS'] != 'Windows':
|
||||
v = sys.version_info
|
||||
|
||||
def copy_var(target, source, env):
|
||||
if env['python_prefix'] == 'USER':
|
||||
if env['python{}_prefix'.format(major)] == 'USER':
|
||||
env['python_module_loc_sc'] = ''
|
||||
else:
|
||||
env['python_module_loc_sc'] = env['python_module_loc']
|
||||
env['python_module_loc_sc'] = env['python{}_module_loc'.format(major)]
|
||||
env['python_cmd'] = env['python{}_cmd'.format(major)]
|
||||
env['python_array_home'] = env['python{}_array_home'.format(major)]
|
||||
|
||||
target = env.SubstFile('setup_cantera', 'setup_cantera.in')
|
||||
localenv.AddPreAction(target, copy_var)
|
||||
localenv.Depends(target, env['install_python2_action'])
|
||||
localenv.Depends(target, env['install_python{}_action'.format(major)])
|
||||
install('$inst_bindir', target)
|
||||
|
||||
# Cantera.mak include file for Makefile projects
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ fi
|
|||
|
||||
if [ "@python_module_loc_sc@" != "" ]; then
|
||||
if [ -z $PYTHONPATH ]; then
|
||||
PYTHONPATH=@python_module_loc@
|
||||
PYTHONPATH=@python_module_loc_sc@
|
||||
else
|
||||
PYTHONPATH=@python_module_loc@:$PYTHONPATH
|
||||
PYTHONPATH=@python_module_loc_sc@:$PYTHONPATH
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -79,16 +79,29 @@ env['matlab_extension'] = ctmethods
|
|||
|
||||
# 'ctpath.m'
|
||||
globalenv = env
|
||||
|
||||
# If any Python 3 package is built, prefer that one. If not,
|
||||
# and if any Python 2 package is built, prefer that one.
|
||||
# In all other cases, use the Python 3 location variables,
|
||||
# which should all be empty strings
|
||||
if env['python3_package'] in ['full', 'minimal']:
|
||||
major = '3'
|
||||
elif env['python2_package'] in ['full', 'minimal']:
|
||||
major = '2'
|
||||
else:
|
||||
major = '3'
|
||||
|
||||
def copy_var(target, source, env):
|
||||
if env['python_prefix'] == 'USER':
|
||||
if env['python{}_prefix'.format(major)] == 'USER':
|
||||
env['python_module_loc_sc'] = ''
|
||||
else:
|
||||
env['python_module_loc_sc'] = globalenv['python_module_loc']
|
||||
env['python_module_loc_sc'] = globalenv['python{}_module_loc'.format(major)]
|
||||
env['python_cmd'] = env['python{}_cmd'.format(major)]
|
||||
|
||||
target = localenv.SubstFile('#interfaces/matlab/ctpath.m',
|
||||
'#interfaces/matlab/ctpath.m.in')
|
||||
localenv.AddPreAction(target, copy_var)
|
||||
localenv.Depends(target, env['install_python2_action'])
|
||||
localenv.Depends(target, env['install_python{}_action'.format(major)])
|
||||
install('$inst_matlab_dir', target)
|
||||
|
||||
# 'Contents.m'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue