* install'u erken kes, bug'i gormek icin, her zaman output dir'i temizlemeye calisma, aman diyeyim

This commit is contained in:
Eray Özkural
2005-06-24 16:04:12 +00:00
parent a256bc0a7d
commit 89fcb110af
3 changed files with 8 additions and 5 deletions
+5 -3
View File
@@ -21,11 +21,12 @@ class ArchiveBase(object):
self.filePath = filepath
self.type = atype
def unpack(self, targetDir):
def unpack(self, targetDir, cleanDir=True):
self.targetDir = targetDir
# first we check if we need to clean-up our working env.
if os.path.exists(self.targetDir):
util.clean_dir(self.targetDir)
if cleanDir:
util.clean_dir(self.targetDir)
else:
os.makedirs(self.targetDir)
@@ -108,7 +109,7 @@ class ArchiveZip(ArchiveBase):
def unpack_file_cond(self, pred, targetDir, archiveRoot=''):
"""Unpack/Extract a file according to predicate function filename ->
bool"""
super(ArchiveZip, self).unpack(targetDir)
super(ArchiveZip, self).unpack(targetDir, False)
zip = self.zip
for fileName in zip.namelist():
if pred(fileName): # check if condition holds
@@ -121,6 +122,7 @@ class ArchiveZip(ArchiveBase):
fileName = util.removepathprefix(archiveRoot, fileName)
print '*', fileName
else:
continue # don't extract if not under
ofile = os.path.join(targetDir, fileName)
print 'ofile ', ofile
+3
View File
@@ -27,6 +27,9 @@ def install(package_fn):
util.clean_dir(config.install_dir())
package.extract_PISI_files(config.install_dir())
import sys
sys.exit(1)
# verify package
# check if we have all required files
-2
View File
@@ -49,11 +49,9 @@ def same(l):
def prefix(a, b):
"check if sequence a is a prefix of sequence b"
print 'PREFIX', a, b
if len(a)>len(b):
return False
for i in range(0,len(a)):
print 'checking', a[i], b[i]
if a[i]!=b[i]:
return False
return True