Remove emptied dir also after removing special files empties dir. This solves the

empty dir problem of perl modules after their pod files are removed.

BUG:FIXED:11588
This commit is contained in:
Faik Uygur
2009-11-23 13:36:58 +00:00
parent d2e28e0bd5
commit b81a4e90d3
2 changed files with 9 additions and 0 deletions
+2
View File
@@ -117,6 +117,8 @@ def exclude_special_files(filepath, fileinfo, ag):
if not pattern in keeplist and re.match(patterns[pattern], fileinfo):
ctx.ui.debug("Removing special %s file: %s" % (pattern, filepath))
os.unlink(filepath)
# Remove dir if it becomes empty (Bug #11588)
pisi.util.rmdirs(os.path.dirname(filepath))
def strip_debug_action(filepath, fileinfo, install_dir, ag):
excludelist = [] if not ag.has_key('NoStrip') else ag['NoStrip']
+7
View File
@@ -668,6 +668,13 @@ def config_changed(config_file):
return True
return False
# recursively remove empty dirs starting from dirpath
def rmdirs(dirpath):
if os.path.isdir(dirpath) and not os.listdir(dirpath):
ctx.ui.debug("Removing empty dir: %s" % dirpath)
os.rmdir(dirpath)
rmdirs(os.path.dirname(dirpath))
# Python regex sucks
# http://mail.python.org/pipermail/python-list/2009-January/523704.html
def letters():