diff --git a/SConstruct b/SConstruct index 56917a0c3..8297ddd7a 100644 --- a/SConstruct +++ b/SConstruct @@ -7,14 +7,16 @@ Basic usage: 'scons build' - Compile Cantera and the language interfaces using default options. + 'scons clean' - Delete files created while building Cantera. + '[sudo] scons install' - Install Cantera. - 'scons test' - Run regression test suite + 'scons test' - Run regression test suite. 'scons test-clean' - Delete files created while running the regression tests. - 'scons msi' - Build a Windows installer (.msi) for Cantera + 'scons msi' - Build a Windows installer (.msi) for Cantera. """ from buildutils import * @@ -27,6 +29,17 @@ if not COMMAND_LINE_TARGETS: extraEnvArgs = {} +if 'clean' in COMMAND_LINE_TARGETS: + removeDirectory('build') + removeDirectory('stage') + removeDirectory('.sconf_temp') + removeFile('.sconsign.dblite') + for name in os.listdir('.'): + if name.endswith('.msi'): + removeFile(name) + print 'Done removing output files.' + sys.exit(0) + if os.name == 'nt': # On Windows, use the same version of Visual Studio that was used # to compile Python, and target the same architecture. diff --git a/site_scons/buildutils.py b/site_scons/buildutils.py index 37fcf2658..1301c2f42 100644 --- a/site_scons/buildutils.py +++ b/site_scons/buildutils.py @@ -8,6 +8,7 @@ import subprocess import difflib import time import types +import shutil class DefineDict(object): """ @@ -387,3 +388,16 @@ def listify(value): else: # Already a sequence. Return as a list return list(value) + + +def removeFile(name): + """ Remove file (if it exists) and print a log message """ + if os.path.exists(name): + print 'Removing file "%s"' % name + os.remove(name) + +def removeDirectory(name): + """ Remove directory recursively and print a log message """ + if os.path.exists(name): + print 'Removing directory "%s"' % name + shutil.rmtree(name)