changeset 6291:05b8e42d6792

Support .7z files There is no tools::p7zip yet. Therefore installation of p7zip is needed to the system. For example. sudo apt-get install p7zip-full
author Masamichi Hosoda <trueroad@users.noreply.github.com>
date Sun, 30 Nov 2014 02:41:49 +0900
parents bc2579b6e0df
children 4af0bd462b71
files gub/repository.py
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gub/repository.py	Sat Nov 29 23:26:30 2014 +0900
+++ b/gub/repository.py	Sun Nov 30 02:41:49 2014 +0900
@@ -544,6 +544,31 @@
 
 RepositoryProxy.register (ZipFile)
 
+class SevenZFile (TarBall):
+    vc_system = '.7z'
+
+    @staticmethod
+    def create (rety, dir, source, branch='', module='', revision='', parameters=list ()):
+        return SevenZFile (dir, source)
+
+    @staticmethod
+    def check_suffix (rety, url):
+         return url and url.endswith (rety.vc_system)
+
+    # TODO: s/url/source
+    def __init__ (self, dir, url, version=None, strip_components=0):
+        TarBall.__init__ (self, dir, url, version, strip_components)
+
+    def _unpack (self, destdir, tarball):
+        strip_components = self.strip_components
+        # fixme
+        #if self.oslog:  #urg, will be fixed when .source is mandatory
+        #    _v = self.oslog.verbose_flag ()
+        _v = ''   #     self.oslog.verbose_flag ()
+        self.system ('7z x %(_v)s %(tarball)s -o%(destdir)s' % locals ())
+
+RepositoryProxy.register (SevenZFile)
+
 class Git (Repository):
     vc_system = '.git'