[jhbuild] Clean builddir on "wipe directory and start over"



commit 7139a961600602dc7e67288b8358d59694748256
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Oct 9 12:51:57 2016 -0500

    Clean builddir on "wipe directory and start over"
    
    This is pretty misleading if we're not actually starting over with a
    clean slate.

 jhbuild/modtypes/__init__.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index 006ac30..60d10d9 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -583,6 +583,14 @@ class DownloadableModule:
         return False
 
     def do_force_checkout(self, buildscript):
+        # Try to wipe the build directory. Ignore exceptions if the child class
+        # does not implement get_builddir().
+        try:
+            builddir = self.get_builddir(buildscript)
+            if os.path.exists(builddir):
+                shutil.rmtree(builddir)
+        except:
+            pass
         buildscript.set_action(_('Checking out'), self)
         self.branch.force_checkout(buildscript)
     do_force_checkout.error_phases = [PHASE_FORCE_CHECKOUT]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]