-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
33 lines (25 loc) · 922 Bytes
/
setup.py
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
31
32
33
#!/bin/env python3
import os
import sys
sdir = os.path.dirname( os.path.realpath(__file__) )
wdir = os.path.relpath( os.path.join(sdir, '..', '..') )
cakedir = wdir + '/src'
execfile("config.py")
print("Notice: taking this as docroot: " + cakedir)
for symlink in symlinks:
ddir = os.path.dirname( symlink[1] )
sfile = symlink[0]
dsym = symlink[1]
if not os.path.isdir( ddir ):
print("Notice: directory not existant.. creating " + ddir)
os.makedirs(ddir)
if not os.path.isfile ( sfile ):
print("Error: source file not existant.. aborting at "+ sfile)
sys.exit()
if os.path.islink ( dsym ):
if os.path.realpath ( dsym ) != sfile:
print("Notice: incorrect symlink.. correcting " + dsym)
os.unlink ( dsym )
else:
continue
os.symlink( os.path.relpath(sfile, os.path.realpath(os.path.dirname(dsym))), dsym )