From 5b278c108317eb04d0f78fc70fff7213ad4e15bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Thu, 22 Sep 2005 10:31:55 +0000 Subject: [PATCH] * #480'i duzelt * a/b/c.html diye bir dosya varsa arsivde daha onceden a directory'sinin vs. yapilmis oldugunu varsayma --- pisi/archive.py | 10 ++++++---- tests/xmlfiletests.py | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pisi/archive.py b/pisi/archive.py index 3a5c8f7c..d31a4792 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -145,17 +145,19 @@ class ArchiveZip(ArchiveBase): ofile = os.path.join(target_dir, outpath) - if is_dir: # a directory is present. - os.mkdir(os.path.join(target_dir, info.filename)) + if is_dir: # this is a directory + os.makedirs(os.path.join(target_dir, info.filename)) continue # check that output dir is present util.check_dir(os.path.dirname(ofile)) + # remove output file we might be overwriting + if os.path.exists(ofile): + os.remove(ofile) + if info.external_attr == self.symmagic: target = zip_obj.read(info.filename) - if os.path.exists(ofile): - os.remove(ofile) os.symlink(target, ofile) else: perm = info.external_attr diff --git a/tests/xmlfiletests.py b/tests/xmlfiletests.py index 189c9724..b1191e05 100644 --- a/tests/xmlfiletests.py +++ b/tests/xmlfiletests.py @@ -26,6 +26,7 @@ class XmlFileTestCase(unittest.TestCase): pisi.api.init(False) def testMetaClass(self): + class OtherInfo: __metaclass__ = xmlfile.autoxml t_BirthDate = [types.StringType, xmlfile.mandatory]