ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/install.py
Revision: 1.6
Committed: Mon Jan 8 13:38:37 2018 UTC (6 years, 3 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, HEAD
Changes since 1.5: +28 -13 lines
Log Message:
Updating to SCons 3.x, adding support for Python 3

File Contents

# Content
1 from __future__ import division, print_function, unicode_literals
2
3 import os
4 import stat
5
6 def install_dir(env, instlist, sbase, tbase, subdir):
7 fulldir = os.path.join(sbase, subdir)
8 l = os.listdir(fulldir)
9 instdir = os.path.join(tbase, subdir)
10 for item in l:
11 if (item[0] == '.'
12 or item[-1] in '%~'
13 or item == 'CVS'
14 or item.lower().startswith('cmake')):
15 continue
16 elif os.path.isdir(os.path.join(fulldir, item)):
17 install_dir(env, instlist, sbase, tbase, os.path.join(subdir, item))
18 else:
19 inst = env.Install(instdir, os.path.join(fulldir, item))
20 instlist.append(inst)
21
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 instlist = []
28 install_dir(env, instlist, sbase, env['RAD_RLIBDIR'], '')
29 env.Append(RAD_RLIBINSTALL=instlist)
30
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 def install_script(target, source, env):
43 #for t,s in map(None,target,source):
44 for t,s in zip(target, source):
45 sf = open(str(s), 'r')
46 tf = open(str(t), 'w')
47 tf.write(sf.read())
48 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
53 def install_tclscript(target, source, env):
54 # XXX posix only for the moment
55 #for t,s in map(None, target,source):
56 for t,s in zip(target, source):
57 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 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
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
83 # vi: set ts=4 sw=4 :