ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/install.py
Revision: 1.4
Committed: Sat Mar 5 13:24:58 2016 UTC (8 years, 2 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
Changes since 1.3: +18 -0 lines
Log Message:
SCons build now fully functional again on linux (SCons 2.3.0, Python 2.7)

File Contents

# Content
1
2 import os
3
4 def install_dir(env, il, sbase, tbase, dir):
5 fulldir = os.path.join(sbase, dir)
6 l = os.listdir(fulldir)
7 instdir = os.path.join(tbase, dir)
8 for item in l:
9 if item[0] == '.' or item[-1] in '%~' or item == 'CVS':
10 continue
11 elif os.path.isdir(os.path.join(fulldir, item)):
12 install_dir(env, il, sbase, tbase, os.path.join(dir, item))
13 else:
14 inst = env.Install(instdir, os.path.join(fulldir, item))
15 il.append(inst)
16
17 def install_rlibfiles(env):
18 buildrlib = env['RAD_BUILDRLIB']
19 if buildrlib[0] == '#':
20 buildrlib = buildrlib[1:]
21 sbase = os.path.join(os.getcwd(), buildrlib)
22 il = []
23 install_dir(env, il, sbase, env['RAD_RLIBDIR'], '')
24 env.Append(RAD_RLIBINSTALL=il)
25
26
27 def install_manfiles(env):
28 buildman = env['RAD_BUILDMAN']
29 if buildman[0] == '#':
30 buildman = buildman[1:]
31 sbase = os.path.join(os.getcwd(), buildman)
32 il = []
33 install_dir(env, il, sbase, env['RAD_MANDIR'], '')
34 env.Append(RAD_MANINSTALL=il)
35
36
37 def install_script(target, source, env):
38 for t,s in map(None,target,source):
39 sf = open(str(s), 'r')
40 tf = open(str(t), 'w')
41 tf.write(sf.read())
42 os.chmod(str(t), 00755)
43
44 def install_tclscript(target, source, env):
45 # XXX posix only for the moment
46 for t,s in map(None, target,source):
47 bindir = os.path.split(t.get_abspath())[0]
48 instdir = os.path.split(bindir)[0]
49 tcllibdir = os.path.join(instdir, 'lib', 'tcl')
50 sf = open(str(s), 'r')
51 tf = open(str(t), 'w')
52 # as recommended in the wish manpage
53 tf.write('''#!/bin/sh\n''')
54 for line in sf.readlines():
55 if line.startswith('#!'):
56 tf.write('### ' + line)
57 if line.startswith('set radlib'):
58 # XXX this should really be handled by an envvar.
59 line = 'set radlib %s\n' % tcllibdir
60 tf.write(line)
61 os.chmod(str(t), 00755)