Fixed the LD_LIBRARY_PATH and PYTHONPATH specifications for scons's test suite on multiuser linux boxes.
The user's environmental variables are now passed down to the tests. Previously they had been ignored. All of the python tests (minimal and full) had been failing for over a year or so for any installations which actually use the LD_LIBRARY_PATH and PYTHONPATH environmental variables, which pretty much consists of all multiuser linux machines.
This commit is contained in:
parent
b0ecf96cb6
commit
3d5aa42e77
3 changed files with 75 additions and 6 deletions
24
SConstruct
24
SConstruct
|
|
@ -135,7 +135,10 @@ if os.name == 'nt':
|
||||||
|
|
||||||
else:
|
else:
|
||||||
toolchain = ['default']
|
toolchain = ['default']
|
||||||
|
#
|
||||||
|
# Go get the environment especially the toolchain which we will use to compile
|
||||||
|
# the code
|
||||||
|
#
|
||||||
env = Environment(tools=toolchain+['textfile', 'subst', 'recursiveInstall', 'wix'],
|
env = Environment(tools=toolchain+['textfile', 'subst', 'recursiveInstall', 'wix'],
|
||||||
ENV={'PATH': os.environ['PATH']},
|
ENV={'PATH': os.environ['PATH']},
|
||||||
toolchain=toolchain,
|
toolchain=toolchain,
|
||||||
|
|
@ -641,12 +644,22 @@ if env['env_vars'] == 'all':
|
||||||
if 'PYTHONHOME' in env['ENV']:
|
if 'PYTHONHOME' in env['ENV']:
|
||||||
del env['ENV']['PYTHONHOME']
|
del env['ENV']['PYTHONHOME']
|
||||||
elif env['env_vars']:
|
elif env['env_vars']:
|
||||||
for name in env['env_vars'].split(','):
|
for name_n in env['env_vars'].split(','):
|
||||||
if name in os.environ:
|
#
|
||||||
|
# Strip name of leading and trailer white space. This is a known error that has led to problems.
|
||||||
|
#
|
||||||
|
name = name_n.strip()
|
||||||
|
print 'name environ lookup is : ', os.environ[name]
|
||||||
|
#
|
||||||
|
# Add name to the saved environment for later use, getting the environmental value
|
||||||
|
#
|
||||||
|
if name in os.environ :
|
||||||
env['ENV'][name] = os.environ[name]
|
env['ENV'][name] = os.environ[name]
|
||||||
elif name not in defaults.env_vars:
|
elif name not in defaults.env_vars:
|
||||||
print 'WARNING: failed to propagate environment variable', name
|
print 'WARNING: failed to propagate environment variable', name
|
||||||
|
print ' Go back and edit cantera.conf file'
|
||||||
|
|
||||||
|
# exit(0)
|
||||||
env['extra_inc_dirs'] = [d for d in env['extra_inc_dirs'].split(':') if d]
|
env['extra_inc_dirs'] = [d for d in env['extra_inc_dirs'].split(':') if d]
|
||||||
env['extra_lib_dirs'] = [d for d in env['extra_lib_dirs'].split(':') if d]
|
env['extra_lib_dirs'] = [d for d in env['extra_lib_dirs'].split(':') if d]
|
||||||
|
|
||||||
|
|
@ -1554,3 +1567,8 @@ if any(target.startswith('test') for target in COMMAND_LINE_TARGETS):
|
||||||
for name in env['testNames']:
|
for name in env['testNames']:
|
||||||
print 'test-%s' % name
|
print 'test-%s' % name
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
#import pdb; pdb.set_trace()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,9 +181,27 @@ def addMatlabTest(script, testName, dependencies=None, env_vars=()):
|
||||||
if localenv['python_package'] in ('full', 'minimal'):
|
if localenv['python_package'] in ('full', 'minimal'):
|
||||||
python_env_vars = {'PYTHONPATH': Dir('#build/python2').abspath,
|
python_env_vars = {'PYTHONPATH': Dir('#build/python2').abspath,
|
||||||
'PYTHON_CMD': localenv.subst('$python_cmd')}
|
'PYTHON_CMD': localenv.subst('$python_cmd')}
|
||||||
|
#
|
||||||
|
# I guess we need to install the current python installation which is located
|
||||||
|
# within our own build directory in front of the existing PYTHONPATH which
|
||||||
|
# contains locations for numpy and other packages
|
||||||
|
#
|
||||||
|
if 'PYTHONPATH' in env['ENV'] :
|
||||||
|
tmpp = Dir('#build/python2').abspath + ':'+ env['ENV']['PYTHONPATH']
|
||||||
|
else:
|
||||||
|
tmpp = Dir('#build/python2').abspath
|
||||||
|
python_env_vars['PYTHONPATH'] = tmpp
|
||||||
|
# print 'python_env_vars = ', python_env_vars['PYTHONPATH']
|
||||||
|
# import pdb; pdb.set_trace()
|
||||||
|
|
||||||
elif localenv['python3_package'] == 'y':
|
elif localenv['python3_package'] == 'y':
|
||||||
python_env_vars = {'PYTHONPATH': Dir('#build/python3').abspath,
|
python_env_vars = {'PYTHONPATH': Dir('#build/python3').abspath,
|
||||||
'PYTHON_CMD': localenv.subst('$python3_cmd')}
|
'PYTHON_CMD': localenv.subst('$python3_cmd')}
|
||||||
|
if 'PYTHONPATH' in env['ENV'] :
|
||||||
|
tmpp = Dir('#build/python3').abspath + ':'+ env['ENV']['PYTHONPATH']
|
||||||
|
else:
|
||||||
|
tmpp = Dir('#build/python3').abspath
|
||||||
|
python_env_vars['PYTHONPATH'] = tmpp
|
||||||
else:
|
else:
|
||||||
python_env_vars = {} # Tests calling ck2cti or ctml_writer will fail
|
python_env_vars = {} # Tests calling ck2cti or ctml_writer will fail
|
||||||
|
|
||||||
|
|
@ -203,6 +221,16 @@ def make_python_tests(version):
|
||||||
# tests (test-cython2) for the main suite.
|
# tests (test-cython2) for the main suite.
|
||||||
for subset in python_subtests:
|
for subset in python_subtests:
|
||||||
name = 'cython%i-' %version + subset if subset else 'cython%i' % version
|
name = 'cython%i-' %version + subset if subset else 'cython%i' % version
|
||||||
|
#
|
||||||
|
# Need to respect the incoming PYTHONPATH variable and to put the current install
|
||||||
|
# dir in front of PYTHONPATH
|
||||||
|
#
|
||||||
|
if 'PYTHONPATH' in env['ENV']:
|
||||||
|
tmpp = Dir('#build/python%i' % version).abspath + ":" + env['ENV']['PYTHONPATH']
|
||||||
|
else:
|
||||||
|
tmpp = Dir('#build/python%i' % version).abspath
|
||||||
|
|
||||||
|
|
||||||
pyTest = addPythonTest(
|
pyTest = addPythonTest(
|
||||||
name, 'python', 'runCythonTests.py',
|
name, 'python', 'runCythonTests.py',
|
||||||
args=subset,
|
args=subset,
|
||||||
|
|
@ -211,7 +239,8 @@ def make_python_tests(version):
|
||||||
dependencies=(localenv['python%i_module' % version] +
|
dependencies=(localenv['python%i_module' % version] +
|
||||||
localenv['python%i_extension' % version] +
|
localenv['python%i_extension' % version] +
|
||||||
mglob(localenv, test_root, 'py')),
|
mglob(localenv, test_root, 'py')),
|
||||||
env_vars={'PYTHONPATH':Dir('#build/python%i' % version).abspath},
|
# env_vars={'PYTHONPATH':Dir('#build/python%i' % version).abspath},
|
||||||
|
env_vars={'PYTHONPATH': tmpp },
|
||||||
optional=bool(subset))
|
optional=bool(subset))
|
||||||
localenv.Alias('test-' + name, pyTest)
|
localenv.Alias('test-' + name, pyTest)
|
||||||
env['testNames'].append(name)
|
env['testNames'].append(name)
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,33 @@ localenv.Prepend(CPPPATH=['#include', '#src', 'shared'])
|
||||||
localenv.Append(CCFLAGS=env['warning_flags'])
|
localenv.Append(CCFLAGS=env['warning_flags'])
|
||||||
|
|
||||||
if localenv['python_package'] in ('full', 'minimal'):
|
if localenv['python_package'] in ('full', 'minimal'):
|
||||||
localenv['ENV']['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'build', 'python2')
|
tmp1 = pjoin(os.getcwd(), '..', 'build', 'python2')
|
||||||
|
#
|
||||||
|
# I guess we need to install the current python installation which is located
|
||||||
|
# within our own build directory in front of the existing PYTHONPATH which
|
||||||
|
# contains locations for numpy and other packages
|
||||||
|
#
|
||||||
|
if 'PYTHONPATH' in env['ENV'] :
|
||||||
|
tmpp = tmp1 + ':' + env['ENV']['PYTHONPATH']
|
||||||
|
else:
|
||||||
|
tmpp = tmp1
|
||||||
|
|
||||||
|
localenv['ENV']['PYTHONPATH'] = tmpp
|
||||||
localenv['ENV']['PYTHON_CMD'] = localenv.subst('$python_cmd')
|
localenv['ENV']['PYTHON_CMD'] = localenv.subst('$python_cmd')
|
||||||
haveConverters = True
|
haveConverters = True
|
||||||
elif localenv['python3_package'] == 'y':
|
elif localenv['python3_package'] == 'y':
|
||||||
localenv['ENV']['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'build', 'python3')
|
tmp1 = pjoin(os.getcwd(), '..', 'build', 'python3')
|
||||||
|
#
|
||||||
|
# I guess we need to install the current python installation which is located
|
||||||
|
# within our own build directory in front of the existing PYTHONPATH which
|
||||||
|
# contains locations for numpy and other packages
|
||||||
|
#
|
||||||
|
if 'PYTHONPATH' in env['ENV'] :
|
||||||
|
tmpp = tmp1 + ':' + env['ENV']['PYTHONPATH']
|
||||||
|
else:
|
||||||
|
tmpp = tmp1
|
||||||
|
|
||||||
|
localenv['ENV']['PYTHONPATH'] = tmpp
|
||||||
localenv['ENV']['PYTHON_CMD'] = localenv.subst('$python3_cmd')
|
localenv['ENV']['PYTHON_CMD'] = localenv.subst('$python3_cmd')
|
||||||
haveConverters = True
|
haveConverters = True
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue