Support glob patterns in shelltools.unlink()

This commit is contained in:
Ozan Çağlayan
2010-01-04 08:00:20 +00:00
parent 4a533ca0bd
commit 528ba418cc
2 changed files with 18 additions and 10 deletions
+4
View File
@@ -1,3 +1,7 @@
2010-01-04 Ozan Çağlayan <ozan@pardus.org.tr>
* pisi/actionsapi/shelltools.py (unlink): Support glob patterns in
unlink().
2009-12-21 Gökçen Eraslan <gokcen@pardus.org.tr> 2009-12-21 Gökçen Eraslan <gokcen@pardus.org.tr>
* pisi/actionsapi/cmaketools.py: Change CMake build type to * pisi/actionsapi/cmaketools.py: Change CMake build type to
RelWithDebInfo to get faster KDE packages. RelWithDebInfo to get faster KDE packages.
+5 -1
View File
@@ -90,8 +90,12 @@ def sym(source, destination):
except OSError: except OSError:
ctx.ui.error(_('ActionsAPI [sym]: Permission denied: %s to %s') % (source, destination)) ctx.ui.error(_('ActionsAPI [sym]: Permission denied: %s to %s') % (source, destination))
def unlink(filePath): def unlink(pattern):
'''remove the file path''' '''remove the file path'''
filePathGlob = glob.glob(pattern)
if len(filePathGlob) == 0:
raise FileError(_("No file matched pattern \"%s\". Remove operation failed.") % pattern)
for filePath in filePathGlob:
if isFile(filePath) or isLink(filePath): if isFile(filePath) or isLink(filePath):
try: try:
os.unlink(filePath) os.unlink(filePath)