Make symlink builder relative

This commit is contained in:
Radim Kolar 2020-06-04 15:57:35 +02:00
parent 816922b3cd
commit ed65d78ae7

View File

@ -1,12 +1,12 @@
# #
# Symlink SCons builder # Relative symlink SCons builder
# #
# Version 1.2 # Version 1.2
# 04-Jun-2020 # 04-Jun-2020
# #
def Symlink(target, source, env=None): def Symlink(target, source, env=None):
"""Create symlink target pointing to source. """Create relative symlink target pointing to source.
This builder creates symlinks named target pointing to source. This builder creates symlinks named target pointing to source.
Target is removed if exists. Target is removed if exists.
@ -28,5 +28,7 @@ def Symlink(target, source, env=None):
os.unlink(str(target[i])) os.unlink(str(target[i]))
except OSError: except OSError:
pass pass
if not str(source[i]).rfind('/') == -1:
source[i]=str(source[i])[str(source[i]).rfind('/')+1:]
os.symlink(str(source[i]),str(target[i])) os.symlink(str(source[i]),str(target[i]))
return None return None