[jhbuild] Don't include .tar.gz in dir names with buildroot set (GNOME bug 676490)



commit efc06a2ede0737a1e5f583be0a4df67859ef6dfa
Author: Craig Keogh <cskeogh adam com au>
Date:   Thu Jun 7 15:28:20 2012 +0930

    Don't include .tar.gz in dir names with buildroot set (GNOME bug 676490)

 jhbuild/versioncontrol/__init__.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/versioncontrol/__init__.py b/jhbuild/versioncontrol/__init__.py
index 6d7395f..16d5ff1 100644
--- a/jhbuild/versioncontrol/__init__.py
+++ b/jhbuild/versioncontrol/__init__.py
@@ -97,7 +97,14 @@ class Branch:
         raise NotImplementedError
 
     def get_module_basename(self):
-        return os.path.basename(self.module)
+        module = os.path.basename(self.module)
+        # prune common filename extensions
+        index = module.lower().rfind('.tar')
+        if index > 0:
+            return module[:index]
+        if len(module) > 4 and module.lower().endswith('.zip'):
+            return module[:-4]
+        return module
 
     def get_checkoutdir(self):
         if self.checkout_mode == 'copy' and self.config.copy_dir:



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