SCons installs the Python module
This commit is contained in:
parent
d742f7d9e6
commit
667b8c3cb6
2 changed files with 34 additions and 7 deletions
|
|
@ -41,4 +41,18 @@ pymodule = localenv.SharedLibrary('Cantera/_cantera', ['src/pycantera.cpp'],
|
|||
buildTargets.extend(pymodule)
|
||||
|
||||
localenv.AddPreAction(pymodule, make_ctconf)
|
||||
localenv.AddPostAction(pymodule, 'cd Cantera/python; python setup.py build')
|
||||
localenv.AddPostAction(pymodule, 'cd Cantera/python; $python_cmd setup.py build')
|
||||
|
||||
if env['cantera_python_home'] is None:
|
||||
# Install Python module in the default location
|
||||
extra = ''
|
||||
elif env['cantera_python_home'] == env['prefix']:
|
||||
# Cantera is being installed with a non-default prefix
|
||||
extra = '--prefix=' + env['prefix']
|
||||
else:
|
||||
# A specific location for the Cantera python module has been specified
|
||||
extra = '--home=' + env['cantera_python_home']
|
||||
|
||||
inst = localenv.Command('dummy', pymodule,
|
||||
'cd Cantera/python; $python_cmd setup.py install %s' % extra)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
25
SConstruct
25
SConstruct
|
|
@ -3,6 +3,15 @@ import platform, sys, os
|
|||
|
||||
env = Environment()
|
||||
|
||||
# ******************************************************
|
||||
# *** Set system-dependent defaults for some options ***
|
||||
# ******************************************************
|
||||
|
||||
if os.name == 'posix':
|
||||
env['default_prefix'] = '/usr/local'
|
||||
elif os.name == 'nt':
|
||||
env['default_prefix'] = os.environ['ProgramFiles']
|
||||
|
||||
# **************************************
|
||||
# *** Read user-configurable options ***
|
||||
# **************************************
|
||||
|
|
@ -10,9 +19,9 @@ env = Environment()
|
|||
opts = Variables('cantera.conf')
|
||||
opts.AddVariables(
|
||||
PathVariable('prefix', 'Where to install Cantera',
|
||||
'/usr/local', PathVariable.PathIsDirCreate),
|
||||
EnumVariable('python_package', 'build python package?', 'default',
|
||||
('full', 'minimal', 'none', 'default')),
|
||||
env['default_prefix'], PathVariable.PathIsDirCreate),
|
||||
EnumVariable('python_package', 'build python package?', 'full',
|
||||
('full', 'minimal', 'none')),
|
||||
PathVariable('python_cmd', 'Path to the python interpreter', sys.executable),
|
||||
EnumVariable('matlab_toolbox', '', 'n', ('y', 'n', 'default')),
|
||||
BoolVariable('f90_interface', 'Build Fortran90 interface?', False),
|
||||
|
|
@ -81,18 +90,22 @@ opts.AddVariables(
|
|||
opts.Update(env)
|
||||
|
||||
# Additional options that apply only if building the full python package
|
||||
if env['prefix'] == env['default_prefix']:
|
||||
pyprefix = None
|
||||
else:
|
||||
pyprefix = env['prefix']
|
||||
|
||||
if env['python_package'] in ('full', 'default'):
|
||||
opts.AddVariables(
|
||||
EnumVariable('python_array', 'Which Python array package to use',
|
||||
'numpy', ('numpy', 'numarray', 'numeric')),
|
||||
BoolVariable('set_python_site_package_topdir', '', False),
|
||||
PathVariable('python_site_package_topdir', '', '/usr/local'),
|
||||
PathVariable('python_array_home',
|
||||
'Location for array package (e.g. if installed with --home)',
|
||||
None, PathVariable.PathAccept),
|
||||
PathVariable('cantera_python_home', 'where to install the python package',
|
||||
None, PathVariable.PathAccept),
|
||||
pyprefix, PathVariable.PathAccept)
|
||||
)
|
||||
|
||||
env['BUILD_PYTHON'] = 3
|
||||
elif env['python_package'] == 'minimal':
|
||||
env['BUILD_PYTHON'] = 1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue