]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
lib/oe/path.py: Add relsymlink()
authorJoshua Watt <JPEWhacker@gmail.com>
Wed, 20 Dec 2023 18:01:01 +0000 (11:01 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 23 Dec 2023 08:43:38 +0000 (08:43 +0000)
Adds API to make a relative symbolic link between two directories. The
arguments are the same as oe.path.symlink()

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/path.py

index e2f1913a35ce50695e055676d1a785195ca8a92e..5d21cdcbdff169d8b325a786e3d3ad14d3f16c9f 100644 (file)
@@ -172,6 +172,9 @@ def symlink(source, destination, force=False):
         if e.errno != errno.EEXIST or os.readlink(destination) != source:
             raise
 
+def relsymlink(target, name, force=False):
+    symlink(os.path.relpath(target, os.path.dirname(name)), name, force=force)
+
 def find(dir, **walkoptions):
     """ Given a directory, recurses into that directory,
     returning all files as absolute paths. """