[Distutils] Patch for clean.py to remove build_scripts directory

Bastian Kleineidam calvin@cs.uni-sb.de
Mon Sep 11 05:45:01 2000


In Distutils-0.9.2 the clean command does not remove the build_scripts
dir. The patch is fixing this.

Bastian

--- clean.py	Sat Aug  5 03:31:54 2000
+++ /usr/local/src/Distutils-0.9.2/distutils/command/clean.py	Mon Sep 11 11:37:02 2000
@@ -20,6 +20,8 @@
          "build directory for all modules (default: 'build.build-lib')"),
         ('build-temp=', 't',
          "temporary build directory (default: 'build.build-temp')"),
+        ('build-scripts=', None,
+         "build directory for scripts (default: 'build.build-scripts')"),
         ('bdist-base=', None,
          "temporary directory for built distributions"),
         ('all', 'a',
@@ -30,6 +32,7 @@
         self.build_base = None
         self.build_lib = None
         self.build_temp = None
+        self.build_scripts = None
         self.bdist_base = None
         self.all = None
 
@@ -37,6 +40,7 @@
         self.set_undefined_options('build',
                                    ('build_base', 'build_base'),
                                    ('build_lib', 'build_lib'),
+                                   ('build_scripts', 'build_scripts'),
                                    ('build_temp', 'build_temp'))
         self.set_undefined_options('bdist',
                                    ('bdist_base', 'bdist_base'))
@@ -50,27 +54,16 @@
             self.warn ("'%s' does not exist -- can't clean it" %
                        self.build_temp)
 
-
-            
-
         if self.all:
-            # remove the module build directory (unless already gone)
-            if os.path.exists (self.build_lib):
-                remove_tree (self.build_lib, self.verbose, self.dry_run)
-            else:
-                self.warn ("'%s' does not exist -- can't clean it" %
-                           self.build_lib)
-
-            # remove the temporary directory used for creating built
-            # distributions (default "build/bdist") -- eg. type of
-            # built distribution will have its own subdirectory under
-            # "build/bdist", but they'll be taken care of by
-            # 'remove_tree()'.
-            if os.path.exists (self.bdist_base):
-                remove_tree (self.bdist_base, self.verbose, self.dry_run)
-            else:
-                self.warn ("'%s' does not exist -- can't clean it" %
-                           self.bdist_base)
+            # remove build directories
+            for directory in (self.build_lib,
+                              self.bdist_base,
+			      self.build_scripts):
+                if os.path.exists (directory):
+                    remove_tree (directory, self.verbose, self.dry_run)
+                else:
+                    self.warn ("'%s' does not exist -- can't clean it" %
+                               directory)
 
         # just for the heck of it, try to remove the base build directory:
         # we might have emptied it right now, but if not we don't care