summaryrefslogtreecommitdiff
path: root/debian/patches/remove_stale_files.patch
blob: 9d776f03ac5409056dbf2fcdbc1ec871dd7998fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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: scons-1.2.0.d20090905/engine/SCons/Script/Main.py
===================================================================
--- scons-1.2.0.d20090905.orig/engine/SCons/Script/Main.py	2009-11-27 16:51:58.000000000 +0000
+++ scons-1.2.0.d20090905/engine/SCons/Script/Main.py	2009-11-27 16:51:53.000000000 +0000
@@ -1022,6 +1022,21 @@
         if not nodes:
             exit_status = 2
 
+        # Remove temporary files left by SCons
+        if options.clean:
+            if os.getenv('DEB_BUILD_ARCH_OS'):
+                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