aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--setup.py2
-rw-r--r--utils.py25
2 files changed, 23 insertions, 4 deletions
diff --git a/setup.py b/setup.py
index ce309fe34..0b566545f 100644
--- a/setup.py
+++ b/setup.py
@@ -1217,7 +1217,7 @@ class pyside_build(_build):
# Update rpath in PySide2 libs
for srcname in pyside_libs:
srcpath = os.path.join(package_path, srcname)
- if os.path.isdir(srcpath):
+ if os.path.isdir(srcpath) or os.path.islink(srcpath):
continue
if not os.path.exists(srcpath):
continue
diff --git a/utils.py b/utils.py
index f7be19d1b..a3f9a41d9 100644
--- a/utils.py
+++ b/utils.py
@@ -231,9 +231,28 @@ def copyfile(src, dst, force=True, vars=None):
log.info("**Skiping copy file %s to %s. Source does not exists." % (src, dst))
return
- log.info("Copying file %s to %s." % (src, dst))
-
- shutil.copy2(src, dst)
+ if not os.path.islink(src):
+ log.info("Copying file %s to %s." % (src, dst))
+ shutil.copy2(src, dst)
+ else:
+ linkTargetPath = os.path.realpath(src)
+ if os.path.dirname(linkTargetPath) == os.path.dirname(src):
+ linkTarget = os.path.basename(linkTargetPath)
+ linkName = os.path.basename(src)
+ currentDirectory = os.getcwd()
+ try:
+ targetDir = dst if os.path.isdir(dst) else os.path.dirname(dst)
+ os.chdir(targetDir)
+ if os.path.exists(linkName):
+ os.remove(linkName)
+ log.info("Symlinking %s -> %s in %s." % (linkName, linkTarget, targetDir))
+ os.symlink(linkTarget, linkName)
+ except OSError:
+ log.error("%s -> %s: Error creating symlink" % (linkName, linkTarget))
+ finally:
+ os.chdir(currentDirectory)
+ else:
+ log.error("%s -> %s: Can only create symlinks within the same directory" % (src, linkTargetPath))
return dst