diff options
author | Chris Johns <chrisj@rtems.org> | 2013-04-13 10:30:07 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-04-13 10:30:07 +1000 |
commit | 06dad0acd8fced37a69167adf1ad892166121201 (patch) | |
tree | 2815ff281f6cf8febd7f944b8a9121fc9e10088a /source-builder/sb/path.py | |
parent | Make the expat library static to make relocatable. (diff) | |
download | rtems-source-builder-06dad0acd8fced37a69167adf1ad892166121201.tar.bz2 |
Make exists support lists. Add a path expander call.
Diffstat (limited to 'source-builder/sb/path.py')
-rw-r--r-- | source-builder/sb/path.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source-builder/sb/path.py b/source-builder/sb/path.py index f138d37..aa48578 100644 --- a/source-builder/sb/path.py +++ b/source-builder/sb/path.py @@ -72,8 +72,13 @@ def splitext(path): root, ext = os.path.splitext(host(path)) return shell(root), ext -def exists(path): - return os.path.exists(host(path)) +def exists(paths): + 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): return os.path.isdir(host(path)) @@ -116,6 +121,12 @@ def removeall(path): shutil.rmtree(path, onerror = _onerror) return +def expand(name, paths): + l = [] + for p in paths: + l += [join(p, name)] + return l + if __name__ == '__main__': print host('/a/b/c/d-e-f') print host('//a/b//c/d-e-f') |