Fix error when removing a symbolic link to a dir

This commit is contained in:
Martin Gracik 2010-10-12 18:56:08 +02:00
parent 45c5ef566c
commit f96f015593

View File

@ -107,10 +107,10 @@ class LoraxYumHelper(object):
fullpattern = joinpaths(self.installroot, pattern) fullpattern = joinpaths(self.installroot, pattern)
count = 0 count = 0
for fname in glob.glob(fullpattern): for fname in glob.glob(fullpattern):
if os.path.isdir(fname): if os.path.islink(fname) or os.path.isfile(fname):
shutil.rmtree(fname)
else:
os.unlink(fname) os.unlink(fname)
else:
shutil.rmtree(fname)
logger.debug("removed {0}".format(fname)) logger.debug("removed {0}".format(fname))
count += 1 count += 1