lib/oe/path: add warning comment about oe.path.remove() with wildcarded filenames
Add a warning in the doc comment for oe.path.remove() about using that function on paths that may contain wildcards in the actual file/directory names. (From OE-Core rev: 18cc0965741102bccc62dfb32ed7753cdacbadc7) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
022a8b58c8
commit
fff7563799
|
@ -92,7 +92,14 @@ def copyhardlinktree(src, dst):
|
||||||
copytree(src, dst)
|
copytree(src, dst)
|
||||||
|
|
||||||
def remove(path, recurse=True):
|
def remove(path, recurse=True):
|
||||||
"""Equivalent to rm -f or rm -rf"""
|
"""
|
||||||
|
Equivalent to rm -f or rm -rf
|
||||||
|
NOTE: be careful about passing paths that may contain filenames with
|
||||||
|
wildcards in them (as opposed to passing an actual wildcarded path) -
|
||||||
|
since we use glob.glob() to expand the path. Filenames containing
|
||||||
|
square brackets are particularly problematic since the they may not
|
||||||
|
actually expand to match the original filename.
|
||||||
|
"""
|
||||||
for name in glob.glob(path):
|
for name in glob.glob(path):
|
||||||
try:
|
try:
|
||||||
os.unlink(name)
|
os.unlink(name)
|
||||||
|
|
Loading…
Reference in New Issue