Description: Remove stale files created by SCons when building Debian packages Origin: Debian Bug-Debian: http://bugs.debian.org/519948 Forwarded: http://scons.tigris.org/issues/show_bug.cgi?id=1571 Index: b/engine/SCons/Script/Main.py =================================================================== --- a/engine/SCons/Script/Main.py 2010-01-23 15:11:19.624932557 +0100 +++ b/engine/SCons/Script/Main.py 2010-01-23 15:11:35.084931903 +0100 @@ -1072,6 +1072,21 @@ if not nodes: exit_status = 2 + # Remove temporary files left by SCons + if options.clean: + if os.environ.has_key('DH_INTERNAL_OPTIONS'): + import shutil + for path in ('.sconsign.dblite', '.sconf_temp'): + try: + if os.path.isfile(path): + print 'Removing autogenerated file %s' % path + os.remove(path) + if os.path.isdir(path): + print 'Removing autogenerated directory %s' % path + shutil.rmtree(path) + except OSError: + pass + def _build_targets(fs, options, targets, target_top): global this_build_status