[library-web] ftp.gnome.org switched to .xz only, trying to handle that



commit 762d51b2b099457e72b9aba969ef33130c01d3c2
Author: FrÃdÃric PÃters <fpeters 0d be>
Date:   Thu Nov 24 09:32:59 2011 +0100

    ftp.gnome.org switched to .xz only, trying to handle that

 src/lgo.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index c29be72..4239be2 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -104,7 +104,9 @@ class FtpDotGnomeDotOrg:
                     latest_base = '%s-%s.' % (module_name, latest_version[0].split('-')[-1])
                     new_basename = [x for x in os.listdir(dirname) if \
                                     x.startswith(latest_base) and (
-                                            x.endswith('.tar.gz') or x.endswith('.tar.bz2'))]
+                                            x.endswith('.tar.gz') or
+                                            x.endswith('.tar.bz2') or
+                                            x.endswith('.tar.xz'))]
                     if new_basename:
                         local_filename = os.path.join(dirname, new_basename[0])
                         logging.debug('using %s instead of %s' % (new_basename[0], basename))
@@ -301,7 +303,12 @@ class Lgo(App):
                 filenames = self.ftp_gnome_org.listdir(base_version_href)
                 filenames = [x for x in filenames if \
                             x.startswith(module + '-%s.' % version_dir) and \
-                             x.endswith('.tar.bz2')]
+                             x.endswith('.tar.xz')]
+                if not filenames:
+                    # not .xz, fallback to .bz2
+                    filenames = [x for x in filenames if \
+                                 x.startswith(module + '-%s.' % version_dir) and \
+                                 x.endswith('.tar.bz2')]
                 def filenames_cmp(x, y):
                     return version_cmp(x[len(module)+1:-8], y[len(module)+1:-8])
                 filenames.sort(filenames_cmp)
@@ -580,7 +587,8 @@ class Lgo(App):
     def process_nightly_tarballs(self):
         logging.info('processing nightly tarballs')
         for filename in os.listdir(self.config.nightly_tarballs_location):
-            if not (filename.endswith('.tar.gz') or filename.endswith('.tar.bz2')):
+            if not (filename.endswith('.tar.gz') or filename.endswith('.tar.bz2') or
+                    filename.endswith('.tar.xz')):
                 continue
             filename = os.path.join(self.config.nightly_tarballs_location, filename)
             for doc_module in self.extract_modules(filename, nightly = True):



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