commit:     e70f11a248bc836da2d5db25171bb59907e14a41
Author:     Brian Dolbec dolsen <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 20 16:24:37 2018 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jul 20 16:36:15 2018 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=e70f11a2

Add glob support to clean_path()

Fixes licecd/rm removals.

Signed-off-by: Brian Dolbec dolsen <dolsen <AT> gentoo.org>

 catalyst/fileops.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/catalyst/fileops.py b/catalyst/fileops.py
index ab6a0c9f..69faf4cb 100644
--- a/catalyst/fileops.py
+++ b/catalyst/fileops.py
@@ -10,6 +10,7 @@ ensuring directories exist,... imports snakeoils osutils
 functions for use throughout catalyst.
 '''
 
+import glob
 import os
 import shutil
 from stat import ST_UID, ST_GID, ST_MODE
@@ -109,9 +110,11 @@ def clear_dir(target, mode=0o755, chg_flags=False, 
remove=False,
        return True
 
 
-def clear_path(target):
-       """Nuke |target| regardless of it being a dir or file."""
-       clear_dir(target, remove=True)
+def clear_path(target_path):
+       """Nuke |target_path| regardless of it being a dir, file or glob."""
+       targets = glob.glob(target_path)
+       for path in targets:
+               clear_dir(path, remove=True)
 
 
 def move_path(src, dest):

Reply via email to