blob: 2ade691d8aae92b9208ce4a5f5e747cd3d1efcf2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env python3
import os
import sys
from pathlib import Path
here = Path(__file__).parent.resolve()
home = Path.home().resolve()
exit = 0
for f in here.glob("dot.*"):
dst = home / Path(
f.name[3:].replace("--", "\ufffd").replace("-", "/").replace("\ufffd", "-")
)
try:
src = f.relative_to(dst.parent)
except ValueError:
src = os.path.relpath(str(f), str(dst.parent))
dst.parent.mkdir(parents=True, exist_ok=True)
try:
dst.symlink_to(src)
except FileExistsError:
if not (dst.parent / src).samefile(dst):
print("{} exists and does not link to {}".format(dst, src))
exit = 1
sys.exit(exit)
|