aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schneider <qsx@qsx.re>2017-08-08 16:18:41 +0200
committerThomas Schneider <qsx@qsx.re>2017-08-08 16:18:41 +0200
commitd47b9983528647d1862169ef3f8446131385f509 (patch)
treead2cb3de99f6346614026560e7e5cdbc93338957
parentebe2122fb7814f62e42e5356aa264eecb6bf8ec2 (diff)
setup.py: Apply some of TobiX’ modifications
Signed-off-by: Thomas Schneider <qsx@qsx.re>
-rwxr-xr-xsetup.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index 173a898..bd58299 100755
--- a/setup.py
+++ b/setup.py
@@ -8,13 +8,18 @@ os.chdir(os.path.dirname(__file__))
exit = 0
for f in glob('dot.*'):
- dst = os.path.expanduser('~/' + f[3:])
+ dst = os.path.expanduser(
+ '~/' + f[3:].replace("--", "\ufffd").replace("-", "/").replace("\ufffd", "-"))
src = os.path.join(os.getcwd(), f)
+ src_rel = os.path.relpath(src, os.path.dirname(dst))
+
+ os.makedirs(os.path.dirname(dst), exist_ok=True)
+
try:
- os.symlink(src, dst)
+ os.symlink(src_rel, dst)
except FileExistsError:
if not os.path.samefile(src, dst):
- print(dst + " exists and does not link do " + dst)
+ print(dst + " exists and does not link do " + src)
exit = 1
sys.exit(exit)