[library-web] Fixed tarball extraction with Python 2.6



commit e126e67df9ff51d195b02c68584f5e603e315650
Author: Frédéric Péters <fpeters 0d be>
Date:   Thu Jun 24 14:27:18 2010 +0200

    Fixed tarball extraction with Python 2.6

 src/lgo.py           |    7 ++++++-
 src/modtypes/base.py |    5 ++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index 2b6a389..2aa1180 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -442,7 +442,12 @@ class Lgo(App):
                     continue
             else:
                 for more_doc in more_tarball_docs[:]:
-                    if tarinfo.name.endswith(more_doc.attrib.get('dir')):
+                    if not tarinfo.isdir():
+                        continue
+                    directory_name = tarinfo.name
+                    if not directory_name[-1] == '/':
+                        directory_name += '/'
+                    if directory_name.endswith(more_doc.attrib.get('dir')):
                         doc = HtmlFilesModule.create_from_tar(tar, tarinfo, more_doc)
                         more_tarball_docs.remove(more_doc)
                         continue
diff --git a/src/modtypes/base.py b/src/modtypes/base.py
index 347475b..2af6e84 100644
--- a/src/modtypes/base.py
+++ b/src/modtypes/base.py
@@ -41,7 +41,10 @@ class DocModule(object):
 
     def create_from_tar(cls, tar, tarinfo, makefile_am, nightly = False):
         self = cls()
-        self.dirname = os.path.dirname(tarinfo.name)
+        if tarinfo.isdir():
+            self.dirname = tarinfo.name
+        else:
+            self.dirname = os.path.dirname(tarinfo.name)
         if makefile_am:
             self.makefile_am = makefile_am
             try:



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