aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-01-03 19:39:23 +0100
committerSimon Warta <[email protected]>2017-01-03 21:38:18 +0100
commit6bb23a9d7ee23e9d0496bd00a2c7d6e5028ae2ed (patch)
treef1fd1299f4b1dc3ecd5f4e10d8e0d12869f27f72
parent4536a57020cdfb1c58316375999d3e50be704e92 (diff)
Fix calculation of symlink target for headers
-rwxr-xr-xconfigure.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/configure.py b/configure.py
index c5e7fcd06..98fca3fe0 100755
--- a/configure.py
+++ b/configure.py
@@ -1807,20 +1807,10 @@ def portable_symlink(filename, target_dir, method):
return
if method == 'symlink':
- def count_dirs(dir, accum = 0):
- if dir in ['', '/', os.path.curdir]:
- return accum
- (dir,basename) = os.path.split(dir)
- return accum + 1 + count_dirs(dir)
-
- dirs_up = count_dirs(target_dir)
- source = os.path.join(os.path.join(*[os.path.pardir] * dirs_up), filename)
- target = os.path.join(target_dir, os.path.basename(filename))
- os.symlink(source, target)
-
+ rel_filename = os.path.relpath(filename, start=target_dir)
+ os.symlink(rel_filename, os.path.join(target_dir, os.path.basename(filename)))
elif method == 'hardlink':
os.link(filename, os.path.join(target_dir, os.path.basename(filename)))
-
elif method == 'copy':
shutil.copy(filename, target_dir)
else: