From 70e10632d4a451dec7e0f94ab2e09156b1a6848b Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 16 Feb 2017 17:31:37 -0500 Subject: [PATCH] [SCons] Fix implicit dependencies on 'build' step The 'install' and 'test' targets had some undeclared dependencies on the 'build' target, such that running 'scons install' or 'scons test' without having first run 'scons build' would result in incomplete installation or test failures, respectively. Fixes #432. --- SConstruct | 1 + interfaces/cython/SConscript | 8 ++++---- test/SConscript | 2 +- test_problems/SConscript | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index f16281a01..433302746 100644 --- a/SConstruct +++ b/SConstruct @@ -1452,6 +1452,7 @@ env.SetOption('max_drift', 2) env.SetOption('implicit_cache', True) buildTargets = [] +env['build_targets'] = buildTargets libraryTargets = [] # objects that go in the Cantera library installTargets = [] sampleTargets = [] diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index 814d64a2d..96dec006e 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -97,6 +97,7 @@ def install_module(prefix, python_version): # Install Python module in the default location extra = '' + env['python%s_module_loc' % ver] = '' if localenv['PYTHON_INSTALLER'] == 'direct': mod_inst = install(localenv.Command, dummy, mod, build_cmd + ' install %s' % extra + @@ -119,12 +120,10 @@ def install_module(prefix, python_version): extra = localenv.subst(' --root=${python%s_prefix}' % ver) install(localenv.Command, dummy, mod, build_cmd + ' install --install-layout=deb --no-compile %s' % extra) - env['python%s_module_loc' % ver] = '' elif localenv['PYTHON_INSTALLER'] == 'binary': install(localenv.Command, dummy, mod, build_cmd + ' bdist_msi --dist-dir=../..' + ' --target-version=%s' % python_version) - env['python%s_module_loc' % ver] = '' dataFiles = localenv.RecursiveInstall('#interfaces/cython/cantera/data', '#build/data') @@ -135,7 +134,8 @@ testFiles = localenv.RecursiveInstall('#interfaces/cython/cantera/test/data', build(testFiles) for f in ['inputs/h2o2.inp', 'inputs/gri30.inp', 'transport/gri30_tran.dat']: - build(localenv.Install('#interfaces/cython/cantera/test/data/', '#data/' + f)) + inp = build(localenv.Install('#interfaces/cython/cantera/test/data/', '#data/' + f)) + testFiles.append(inp) # Cython module for Python 3.x if localenv['python3_package'] == 'y': @@ -201,7 +201,7 @@ if localenv['python_package'] == 'full': a = build(py2env.Command(pjoin(targetdir, subdir, filename), pjoin(dirpath, filename), convert_example)) - py2env.Depends(a, mod) + py2env.Depends(mod, a) add_dependencies(mod, ext) install_module(py2env['python_prefix'], py2_version) diff --git a/test/SConscript b/test/SConscript index 9543a3215..d928465bf 100644 --- a/test/SConscript +++ b/test/SConscript @@ -82,7 +82,7 @@ def addTestProgram(subdir, progName, env_vars={}): PASSED_FILES[progName] = str(passedFile) testResults.tests[passedFile.name] = program run_program = testenv.Command(passedFile, program, gtestRunner) - env.Depends(run_program, testenv.get('cantera_shlib', ())) + env.Depends(run_program, env['build_targets']) env.Depends(env['test_results'], run_program) Alias('test-%s' % progName, run_program) env['testNames'].append(progName) diff --git a/test_problems/SConscript b/test_problems/SConscript index d11db5a88..d11a4edc3 100644 --- a/test_problems/SConscript +++ b/test_problems/SConscript @@ -76,6 +76,7 @@ class Test(object): testResults.tests[self.testName] = self run = self.run(localenv) localenv.Depends(env['test_results'], run) + localenv.Depends(run, env['build_targets']) localenv.Alias('test-clean', self.clean(localenv)) localenv.Alias('test-%s' % self.testName, run) env['testNames'].append(self.testName)