[library-web] Fixed dirname matching for some cases, with Python 2.4



commit 0ec578506ba5d8f6007152ae3613ee4faadb8e9e
Author: Frédéric Péters <fpeters 0d be>
Date:   Mon Jun 28 10:37:23 2010 +0200

    Fixed dirname matching for some cases, with Python 2.4

 src/modtypes/base.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/modtypes/base.py b/src/modtypes/base.py
index 2af6e84..0f5b808 100644
--- a/src/modtypes/base.py
+++ b/src/modtypes/base.py
@@ -89,11 +89,15 @@ class DocModule(object):
 
         base_tarball_name = os.path.basename(self.filename).rsplit('-', 1)[0]
 
+        dirname = self.dirname
+        if dirname.endswith('/'):
+            dirname = dirname[:-1]
+
         if not os.path.exists(os.path.join(ext_dirname, self.dirname)):
             logging.debug('extracting %s' % self.dirname)
             tar = tarfile.open(self.filename, 'r')
             for tarinfo in tar.getmembers():
-                if not os.path.split(tarinfo.name)[0].startswith(self.dirname):
+                if not os.path.split(tarinfo.name)[0].startswith(dirname):
                     continue
                 dest = os.path.join(ext_dirname, tarinfo.name)
                 if tarinfo.isdir() and not os.path.exists(dest):



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