1 |
|
|
2 |
+ |
import os |
3 |
|
import sys |
4 |
|
import string |
5 |
|
|
5 |
– |
_ltext = ''' |
6 |
|
|
7 |
< |
RADIANCE LICENSE AGREEMENT |
7 |
> |
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 |
< |
Radiance is a registered copyright of The Regents of the University of |
24 |
< |
California ("The Regents"). The Regents grant to you a nonexclusive, |
25 |
< |
nontransferable license ("License") to use Radiance source code without |
26 |
< |
fee. You may not sell or distribute Radiance to others without the |
27 |
< |
prior express written permission of The Regents. You may compile and |
28 |
< |
use this software on any machines to which you have personal access, |
15 |
< |
and may share its use with others who have access to the same machines. |
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 |
|
|
17 |
– |
NEITHER THE UNITED STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY |
18 |
– |
OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY |
19 |
– |
LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS |
20 |
– |
OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS |
21 |
– |
THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. By downloading, using |
22 |
– |
or copying this software, you agree to abide by the intellectual property laws |
23 |
– |
and all other applicable laws of the United States, and by the terms of this |
24 |
– |
License Agreement. Ownership of the software shall remain solely in The |
25 |
– |
Regents. The Regents shall have the right to terminate this License |
26 |
– |
immediately by written notice upon your breach of, or noncompliance with, any |
27 |
– |
of its terms. You shall be liable for any infringement or damages resulting |
28 |
– |
from your failure to abide by the terms of this License Agreement. |
29 |
– |
|
30 |
– |
|
31 |
– |
|
32 |
– |
''' |
33 |
– |
|
30 |
|
def show_license(): |
31 |
< |
sys.stderr.write(_ltext) |
32 |
< |
sys.stderr.write( |
33 |
< |
'Do you understand and accept the terms of this agreement [n]?\n\n') |
31 |
> |
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 |
< |
answer = '' |
43 |
< |
s = 'Please enter "yes" or "no", or use ^C to exit: ' |
44 |
< |
while answer not in ['y', 'ye', 'yes', 'n', 'no']: |
45 |
< |
if answer: sys.stderr.write('invalid input "%s"\n' % answer) |
46 |
< |
answer = string.lower(raw_input(s)) |
47 |
< |
|
45 |
< |
if answer[0] == 'y': |
46 |
< |
return |
47 |
< |
else: |
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 |
|
sys.stderr.write('\n*** Installation cancelled ***\n') |
49 |
|
sys.exit(1) |
50 |
|
|