ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/copyright.py
Revision: 1.3
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.2: +8 -3 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 sys
5 import builtins
6 if hasattr(builtins, 'raw_input'): # < Py3
7 input = builtins.raw_input
8
9
10 def _get_ltextl():
11 f = open(os.path.join('src','common','copyright.h'), 'r')
12 ltl = f.readlines()
13 f.close()
14 ltl2 = []
15 for line in ltl:
16 line = line.strip()
17 if line == '*/': line = ''
18 elif line.find('$Id:') > -1: line = ''
19 elif line and line[0] == '*':
20 line = line[2:]
21 elif line and line[1] == '*':
22 line = line[3:]
23 ltl2.append(line)
24 return ltl2 + ['']
25
26 def _show_ltextl(ltextl, lines=23):
27 llen = len(ltextl)
28 for i in range(0, llen, lines):
29 sys.stderr.write('\n'.join(ltextl[i:i+lines]))
30 if i+lines < llen:
31 input('\n[press <return> to continue] ')
32
33 def show_license():
34 try:
35 ltextl = _get_ltextl()
36 _show_ltextl(ltextl)
37 sys.stderr.write(
38 'Do you understand and accept the terms of this agreement [n]?\n\n')
39 answer = ''
40 s = 'Please enter "yes" or "no", or use ^C to exit: '
41 while answer not in ['y', 'ye', 'yes', 'n', 'no']:
42 if answer: sys.stderr.write('invalid input "%s"\n' % answer)
43 answer = input(s).lower()
44
45 if answer[0] == 'y':
46 return
47 else:
48 sys.stderr.write('\n*** Installation cancelled ***\n')
49 sys.exit(1)
50 except KeyboardInterrupt:
51 sys.stderr.write('\n*** Installation cancelled ***\n')
52 sys.exit(1)
53
54 # vi: set ts=4 sw=4 :
55