* os.path.split ve range() ile ilgili hatalari duzelt ve debug loglari ekle
This commit is contained in:
@@ -117,10 +117,13 @@ class ArchiveZip(ArchiveBase):
|
|||||||
if archiveRoot!='':
|
if archiveRoot!='':
|
||||||
# change archiveRoot
|
# change archiveRoot
|
||||||
if util.subpath(archiveRoot, fileName):
|
if util.subpath(archiveRoot, fileName):
|
||||||
|
print '!', archiveRoot, fileName
|
||||||
fileName = util.removepathprefix(archiveRoot, fileName)
|
fileName = util.removepathprefix(archiveRoot, fileName)
|
||||||
|
print '*', fileName
|
||||||
else:
|
else:
|
||||||
continue # don't extract if not under
|
continue # don't extract if not under
|
||||||
ofile = os.path.join(targetDir, fileName)
|
ofile = os.path.join(targetDir, fileName)
|
||||||
|
print 'ofile ', ofile
|
||||||
|
|
||||||
# a directory is present. lets continue
|
# a directory is present. lets continue
|
||||||
if ofile[len(ofile)-1]=='/':
|
if ofile[len(ofile)-1]=='/':
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ def install(package_fn):
|
|||||||
|
|
||||||
# unzip package in place
|
# unzip package in place
|
||||||
ui.info('Extracting files\n')
|
ui.info('Extracting files\n')
|
||||||
#package.extract_dir_flat('install', config.destdir)
|
package.extract_dir_flat('install', config.destdir)
|
||||||
|
|
||||||
# update databases
|
# update databases
|
||||||
|
|
||||||
|
|||||||
+14
-4
@@ -49,9 +49,11 @@ def same(l):
|
|||||||
|
|
||||||
def prefix(a, b):
|
def prefix(a, b):
|
||||||
"check if sequence a is a prefix of sequence b"
|
"check if sequence a is a prefix of sequence b"
|
||||||
|
print 'PREFIX', a, b
|
||||||
if len(a)>len(b):
|
if len(a)>len(b):
|
||||||
return False
|
return False
|
||||||
for i in range(0,len(a)-1):
|
for i in range(0,len(a)):
|
||||||
|
print 'checking', a[i], b[i]
|
||||||
if a[i]!=b[i]:
|
if a[i]!=b[i]:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@@ -63,13 +65,21 @@ def remove_prefix(a,b):
|
|||||||
|
|
||||||
# path functions
|
# path functions
|
||||||
|
|
||||||
|
def splitpath(a):
|
||||||
|
"""split path into components and return as a list
|
||||||
|
os.path.split doesn't do what I want"""
|
||||||
|
l = a.split(os.path.sep)
|
||||||
|
if l[len(l)-1]=='':
|
||||||
|
l.pop()
|
||||||
|
return l
|
||||||
|
|
||||||
# I'm not sure how necessary this is. Ahem.
|
# I'm not sure how necessary this is. Ahem.
|
||||||
def commonprefix(l):
|
def commonprefix(l):
|
||||||
"""an improved version of os.path.commonprefix,
|
"""an improved version of os.path.commonprefix,
|
||||||
returns a list of path components"""
|
returns a list of path components"""
|
||||||
common = []
|
common = []
|
||||||
comps = map(os.path.split, l)
|
comps = map(splitpath, l)
|
||||||
for i in range(0, min(len,l)-1):
|
for i in range(0, min(len,l)):
|
||||||
compi = map(lambda x: x[i], comps) # get ith slice
|
compi = map(lambda x: x[i], comps) # get ith slice
|
||||||
if same(compi):
|
if same(compi):
|
||||||
common.append(compi[0])
|
common.append(compi[0])
|
||||||
@@ -78,7 +88,7 @@ def commonprefix(l):
|
|||||||
# but this one is necessary
|
# but this one is necessary
|
||||||
def subpath(a, b):
|
def subpath(a, b):
|
||||||
"find if path a is before b in the directory tree"
|
"find if path a is before b in the directory tree"
|
||||||
return prefix(os.path.split(a), os.path.split(b))
|
return prefix(splitpath(a), splitpath(b))
|
||||||
|
|
||||||
def removepathprefix(a, b):
|
def removepathprefix(a, b):
|
||||||
"remove path prefix a from p, finding the pathname rooted at a"
|
"remove path prefix a from p, finding the pathname rooted at a"
|
||||||
|
|||||||
Reference in New Issue
Block a user