| 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) |