aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/path.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/path.py')
-rw-r--r--meta/lib/oe/path.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 8902951581..f58c0138bb 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -42,3 +42,25 @@ def format_display(path, metadata):
return path
else:
return rel
+
+def remove(path):
+ """Equivalent to rm -f or rm -rf"""
+ import os, errno, shutil
+ try:
+ os.unlink(path)
+ except OSError, exc:
+ if exc.errno == errno.EISDIR:
+ shutil.rmtree(path)
+ elif exc.errno != errno.ENOENT:
+ raise
+
+def symlink(source, destination, force=False):
+ """Create a symbolic link"""
+ import os, errno
+ try:
+ if force:
+ remove(destination)
+ os.symlink(source, destination)
+ except OSError, e:
+ if e.errno != errno.EEXIST or os.readlink(destination) != source:
+ raise