[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.
This commit is contained in:
Ray Speth
2017-02-16 17:31:37 -05:00
parent 0a1257daed
commit 70e10632d4
4 changed files with 7 additions and 5 deletions

View File

@@ -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 = []

View File

@@ -97,6 +97,7 @@ def install_module(prefix, python_version):
# Install Python module in the default location
extra = ''
env['python%s_module_loc' % ver] = '<unspecified>'
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] = '<unspecified>'
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] = '<unspecified>'
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)

View File

@@ -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)

View File

@@ -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)