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.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/oe/path.py b/lib/oe/path.py
index a145456659..f58c0138bb 100644
--- a/lib/oe/path.py
+++ b/lib/oe/path.py
@@ -53,3 +53,14 @@ def remove(path):
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