Added 'scons clean' target

This commit is contained in:
Ray Speth 2012-01-05 22:22:23 +00:00
parent f40e5e352e
commit 3062ddf621
2 changed files with 29 additions and 2 deletions

View file

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

View file

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