mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
Make exists support lists. Add a path expander call.
This commit is contained in:
parent
7e48e8fb57
commit
06dad0acd8
@ -72,8 +72,13 @@ def splitext(path):
|
|||||||
root, ext = os.path.splitext(host(path))
|
root, ext = os.path.splitext(host(path))
|
||||||
return shell(root), ext
|
return shell(root), ext
|
||||||
|
|
||||||
def exists(path):
|
def exists(paths):
|
||||||
return os.path.exists(host(path))
|
if type(paths) == list:
|
||||||
|
results = []
|
||||||
|
for p in paths:
|
||||||
|
results += [os.path.exists(host(p))]
|
||||||
|
return results
|
||||||
|
return os.path.exists(host(paths))
|
||||||
|
|
||||||
def isdir(path):
|
def isdir(path):
|
||||||
return os.path.isdir(host(path))
|
return os.path.isdir(host(path))
|
||||||
@ -116,6 +121,12 @@ def removeall(path):
|
|||||||
shutil.rmtree(path, onerror = _onerror)
|
shutil.rmtree(path, onerror = _onerror)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def expand(name, paths):
|
||||||
|
l = []
|
||||||
|
for p in paths:
|
||||||
|
l += [join(p, name)]
|
||||||
|
return l
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print host('/a/b/c/d-e-f')
|
print host('/a/b/c/d-e-f')
|
||||||
print host('//a/b//c/d-e-f')
|
print host('//a/b//c/d-e-f')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user