comparison test-svn.py @ 20:5bfa23cd638d

More ZIP archive fixes One typo and one Windows incompatibility fixed.
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 14 Jun 2010 21:02:06 +0000
parents d4fc9341664e
children f90bd2d1a12b
comparison
equal deleted inserted replaced
19:d4fc9341664e 20:5bfa23cd638d
354 oldcwd = os.getcwdu() 354 oldcwd = os.getcwdu()
355 os.chdir('/') # FIXME: portability? 355 os.chdir('/') # FIXME: portability?
356 f = zipfile.ZipFile(os.path.join(oldcwd, 'tests.zip')) 356 f = zipfile.ZipFile(os.path.join(oldcwd, 'tests.zip'))
357 try: 357 try:
358 m = f.getinfo(name) 358 m = f.getinfo(name)
359 m.filename = target[1:] 359 m.filename = os.path.relpath(target)
360 f.extract(m) 360 f.extract(m)
361 f.close() 361 f.close()
362 os.chdir(oldcwd) 362 os.chdir(oldcwd)
363 return True 363 return True
364 except KeyError: 364 except KeyError:
365 f.close() 365 f.close()
366 os.chdir(oldwcd) 366 os.chdir(oldcwd)
367 if os.path.isfile('tests.tgz'): 367 if os.path.isfile('tests.tgz'):
368 f = tarfile.open('tests.tgz') 368 f = tarfile.open('tests.tgz')
369 try: 369 try:
370 m = f.getmember(name) 370 m = f.getmember(name)
371 m.name = target 371 m.name = target