aboutsummaryrefslogtreecommitdiffstats
path: root/lib/oe/path.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oe/path.py')
-rw-r--r--lib/oe/path.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/oe/path.py b/lib/oe/path.py
index 3d64cfaac1..65b438a0e3 100644
--- a/lib/oe/path.py
+++ b/lib/oe/path.py
@@ -1,6 +1,7 @@
+import os
+
def join(*paths):
"""Like os.path.join but doesn't treat absolute RHS specially"""
- import os.path
return os.path.normpath("/".join(paths))
def relative(src, dest):
@@ -15,7 +16,6 @@ def relative(src, dest):
>>> relative("/tmp", "/tmp/foo/bar")
foo/bar
"""
- import os.path
if hasattr(os.path, "relpath"):
return os.path.relpath(dest, src)
@@ -64,3 +64,11 @@ def symlink(source, destination, force=False):
except OSError, e:
if e.errno != errno.EEXIST or os.readlink(destination) != source:
raise
+
+def find(dir, **walkoptions):
+ """ Given a directory, recurses into that directory,
+ returning all files as absolute paths. """
+
+ for root, dirs, files in os.walk(dir, **walkoptions):
+ for file in files:
+ yield os.path.join(root, file)