diff --git a/SConstruct b/SConstruct index 3ee063aaa..afccd1473 100644 --- a/SConstruct +++ b/SConstruct @@ -135,7 +135,10 @@ if os.name == 'nt': else: 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={'PATH': os.environ['PATH']}, toolchain=toolchain, @@ -641,12 +644,22 @@ if env['env_vars'] == 'all': if 'PYTHONHOME' in env['ENV']: del env['ENV']['PYTHONHOME'] elif env['env_vars']: - for name in env['env_vars'].split(','): - if name in os.environ: + for name_n in env['env_vars'].split(','): + # + # 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] elif name not in defaults.env_vars: 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_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']: print 'test-%s' % name sys.exit(0) + + +#import pdb; pdb.set_trace() + + diff --git a/test/SConscript b/test/SConscript index 4e98f4ce6..00a47426e 100644 --- a/test/SConscript +++ b/test/SConscript @@ -181,9 +181,27 @@ def addMatlabTest(script, testName, dependencies=None, env_vars=()): if localenv['python_package'] in ('full', 'minimal'): python_env_vars = {'PYTHONPATH': Dir('#build/python2').abspath, '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': python_env_vars = {'PYTHONPATH': Dir('#build/python3').abspath, '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: 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. for subset in python_subtests: 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( name, 'python', 'runCythonTests.py', args=subset, @@ -211,7 +239,8 @@ def make_python_tests(version): dependencies=(localenv['python%i_module' % version] + localenv['python%i_extension' % version] + 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)) localenv.Alias('test-' + name, pyTest) env['testNames'].append(name) diff --git a/test_problems/SConscript b/test_problems/SConscript index fcfb0ea42..406bea101 100644 --- a/test_problems/SConscript +++ b/test_problems/SConscript @@ -6,11 +6,33 @@ localenv.Prepend(CPPPATH=['#include', '#src', 'shared']) localenv.Append(CCFLAGS=env['warning_flags']) 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') haveConverters = True 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') haveConverters = True else: