do guarded programming, but don't absorb errors. it's no good :).
This commit is contained in:
+3
-4
@@ -146,10 +146,9 @@ class ArchiveZip(ArchiveBase):
|
|||||||
ofile = os.path.join(target_dir, outpath)
|
ofile = os.path.join(target_dir, outpath)
|
||||||
|
|
||||||
if is_dir: # this is a directory
|
if is_dir: # this is a directory
|
||||||
try: # To get rid of Error:[Errno 17] File exists: errors
|
d = os.path.join(target_dir, outpath)
|
||||||
os.makedirs(os.path.join(target_dir, outpath))
|
if not os.path.isdir(d):
|
||||||
except OSError:
|
os.makedirs(d)
|
||||||
pass
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# check that output dir is present
|
# check that output dir is present
|
||||||
|
|||||||
+5
-5
@@ -44,12 +44,12 @@ def remove_single(package_name):
|
|||||||
if os.path.isfile(fpath):
|
if os.path.isfile(fpath):
|
||||||
os.rename(fpath, fpath + ".pisi")
|
os.rename(fpath, fpath + ".pisi")
|
||||||
else:
|
else:
|
||||||
try:
|
# check if file is removed manually.
|
||||||
|
# And we don't remove directories!
|
||||||
|
# FIXME: should give a warning if it is...
|
||||||
|
if os.path.isfile(fpath):
|
||||||
os.unlink(fpath)
|
os.unlink(fpath)
|
||||||
except OSError:
|
|
||||||
# file is removed (maybe manually)
|
|
||||||
# FIXME: should give a warning
|
|
||||||
pass
|
|
||||||
|
|
||||||
ctx.installdb.remove(package_name)
|
ctx.installdb.remove(package_name)
|
||||||
packagedb.remove_package(package_name)
|
packagedb.remove_package(package_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user