1 |
schorsch |
1.6 |
from __future__ import division, print_function, unicode_literals |
2 |
schorsch |
1.1 |
|
3 |
|
|
import os |
4 |
schorsch |
1.6 |
import stat |
5 |
schorsch |
1.1 |
|
6 |
schorsch |
1.6 |
def install_dir(env, instlist, sbase, tbase, subdir): |
7 |
|
|
fulldir = os.path.join(sbase, subdir) |
8 |
schorsch |
1.1 |
l = os.listdir(fulldir) |
9 |
schorsch |
1.6 |
instdir = os.path.join(tbase, subdir) |
10 |
schorsch |
1.1 |
for item in l: |
11 |
schorsch |
1.6 |
if (item[0] == '.' |
12 |
|
|
or item[-1] in '%~' |
13 |
|
|
or item == 'CVS' |
14 |
|
|
or item.lower().startswith('cmake')): |
15 |
schorsch |
1.1 |
continue |
16 |
|
|
elif os.path.isdir(os.path.join(fulldir, item)): |
17 |
schorsch |
1.6 |
install_dir(env, instlist, sbase, tbase, os.path.join(subdir, item)) |
18 |
schorsch |
1.1 |
else: |
19 |
|
|
inst = env.Install(instdir, os.path.join(fulldir, item)) |
20 |
schorsch |
1.6 |
instlist.append(inst) |
21 |
schorsch |
1.1 |
|
22 |
|
|
def install_rlibfiles(env): |
23 |
|
|
buildrlib = env['RAD_BUILDRLIB'] |
24 |
|
|
if buildrlib[0] == '#': |
25 |
|
|
buildrlib = buildrlib[1:] |
26 |
|
|
sbase = os.path.join(os.getcwd(), buildrlib) |
27 |
schorsch |
1.6 |
instlist = [] |
28 |
|
|
install_dir(env, instlist, sbase, env['RAD_RLIBDIR'], '') |
29 |
|
|
env.Append(RAD_RLIBINSTALL=instlist) |
30 |
schorsch |
1.1 |
|
31 |
|
|
|
32 |
|
|
def install_manfiles(env): |
33 |
|
|
buildman = env['RAD_BUILDMAN'] |
34 |
|
|
if buildman[0] == '#': |
35 |
|
|
buildman = buildman[1:] |
36 |
|
|
sbase = os.path.join(os.getcwd(), buildman) |
37 |
|
|
il = [] |
38 |
|
|
install_dir(env, il, sbase, env['RAD_MANDIR'], '') |
39 |
|
|
env.Append(RAD_MANINSTALL=il) |
40 |
|
|
|
41 |
|
|
|
42 |
schorsch |
1.3 |
def install_script(target, source, env): |
43 |
schorsch |
1.6 |
#for t,s in map(None,target,source): |
44 |
|
|
for t,s in zip(target, source): |
45 |
schorsch |
1.2 |
sf = open(str(s), 'r') |
46 |
|
|
tf = open(str(t), 'w') |
47 |
|
|
tf.write(sf.read()) |
48 |
schorsch |
1.6 |
os.chmod(str(t), |
49 |
|
|
stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | |
50 |
|
|
stat.S_IRGRP | stat.S_IWGRP | |
51 |
|
|
stat.S_IROTH | stat.S_IWOTH) |
52 |
schorsch |
1.2 |
|
53 |
schorsch |
1.4 |
def install_tclscript(target, source, env): |
54 |
|
|
# XXX posix only for the moment |
55 |
schorsch |
1.6 |
#for t,s in map(None, target,source): |
56 |
|
|
for t,s in zip(target, source): |
57 |
schorsch |
1.4 |
bindir = os.path.split(t.get_abspath())[0] |
58 |
|
|
instdir = os.path.split(bindir)[0] |
59 |
|
|
tcllibdir = os.path.join(instdir, 'lib', 'tcl') |
60 |
|
|
sf = open(str(s), 'r') |
61 |
|
|
tf = open(str(t), 'w') |
62 |
|
|
# as recommended in the wish manpage |
63 |
|
|
tf.write('''#!/bin/sh\n''') |
64 |
|
|
for line in sf.readlines(): |
65 |
|
|
if line.startswith('#!'): |
66 |
|
|
tf.write('### ' + line) |
67 |
|
|
if line.startswith('set radlib'): |
68 |
|
|
# XXX this should really be handled by an envvar. |
69 |
|
|
line = 'set radlib %s\n' % tcllibdir |
70 |
|
|
tf.write(line) |
71 |
schorsch |
1.6 |
os.chmod(str(t), |
72 |
|
|
stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | |
73 |
|
|
stat.S_IRGRP | stat.S_IWGRP | |
74 |
|
|
stat.S_IROTH | stat.S_IWOTH) |
75 |
schorsch |
1.5 |
|
76 |
|
|
def build_with_pyinstaller(targets, sources, env): |
77 |
|
|
workpath = env.Dir('$RAD_BUILDOBJ', 'pybuild') # --workpath @ |
78 |
|
|
specpath = workpath # --specpath @ |
79 |
|
|
# -F # one-file |
80 |
|
|
# --noconsole |
81 |
|
|
pass |
82 |
schorsch |
1.6 |
|
83 |
|
|
# vi: set ts=4 sw=4 : |