ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/copyright.py
Revision: 1.2
Committed: Fri Dec 12 15:48:31 2003 UTC (20 years, 3 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1
Changes since 1.1: +40 -40 lines
Log Message:
Switching to current license text loaded from src/common/copyright.h.

File Contents

# User Rev Content
1 schorsch 1.1
2 schorsch 1.2 import os
3 schorsch 1.1 import sys
4     import string
5    
6    
7 schorsch 1.2 def _get_ltextl():
8     f = open(os.path.join('src','common','copyright.h'), 'r')
9     ltl = f.readlines()
10     f.close()
11     ltl2 = []
12     for line in ltl:
13     line = line.strip()
14     if line == '*/': line = ''
15     elif line.find('$Id:') > -1: line = ''
16     elif line and line[0] == '*':
17     line = line[2:]
18     elif line and line[1] == '*':
19     line = line[3:]
20     ltl2.append(line)
21     return ltl2 + ['']
22    
23     def _show_ltextl(ltextl, lines=23):
24     llen = len(ltextl)
25     for i in range(0, llen, lines):
26     sys.stderr.write('\n'.join(ltextl[i:i+lines]))
27     if i+lines < llen:
28     raw_input('\n[press <return> to continue] ')
29 schorsch 1.1
30     def show_license():
31 schorsch 1.2 try:
32     ltextl = _get_ltextl()
33     _show_ltextl(ltextl)
34     sys.stderr.write(
35     'Do you understand and accept the terms of this agreement [n]?\n\n')
36     answer = ''
37     s = 'Please enter "yes" or "no", or use ^C to exit: '
38     while answer not in ['y', 'ye', 'yes', 'n', 'no']:
39     if answer: sys.stderr.write('invalid input "%s"\n' % answer)
40     answer = string.lower(raw_input(s))
41    
42     if answer[0] == 'y':
43     return
44     else:
45     sys.stderr.write('\n*** Installation cancelled ***\n')
46     sys.exit(1)
47     except KeyboardInterrupt:
48 schorsch 1.1 sys.stderr.write('\n*** Installation cancelled ***\n')
49     sys.exit(1)
50