Support glob patterns in shelltools.unlink()
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -90,17 +90,21 @@ 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'''
|
||||||
if isFile(filePath) or isLink(filePath):
|
filePathGlob = glob.glob(pattern)
|
||||||
try:
|
if len(filePathGlob) == 0:
|
||||||
os.unlink(filePath)
|
raise FileError(_("No file matched pattern \"%s\". Remove operation failed.") % pattern)
|
||||||
except OSError:
|
for filePath in filePathGlob:
|
||||||
ctx.ui.error(_('ActionsAPI [unlink]: Permission denied: %s.') % (filePath))
|
if isFile(filePath) or isLink(filePath):
|
||||||
elif isDirectory(filePath):
|
try:
|
||||||
pass
|
os.unlink(filePath)
|
||||||
else:
|
except OSError:
|
||||||
ctx.ui.error(_('ActionsAPI [unlink]: File %s doesn\'t exists.') % (filePath))
|
ctx.ui.error(_('ActionsAPI [unlink]: Permission denied: %s.') % (filePath))
|
||||||
|
elif isDirectory(filePath):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
ctx.ui.error(_('ActionsAPI [unlink]: File %s doesn\'t exists.') % (filePath))
|
||||||
|
|
||||||
def unlinkDir(sourceDirectory):
|
def unlinkDir(sourceDirectory):
|
||||||
'''delete an entire directory tree'''
|
'''delete an entire directory tree'''
|
||||||
|
|||||||
Reference in New Issue
Block a user