1 |
+ |
from __future__ import division, print_function, unicode_literals |
2 |
|
|
3 |
+ |
import os |
4 |
|
import sys |
5 |
< |
import string |
5 |
> |
import builtins |
6 |
> |
if hasattr(builtins, 'raw_input'): # < Py3 |
7 |
> |
input = builtins.raw_input |
8 |
|
|
5 |
– |
_ltext = ''' |
9 |
|
|
10 |
< |
RADIANCE LICENSE AGREEMENT |
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 |
< |
Radiance is a registered copyright of The Regents of the University of |
27 |
< |
California ("The Regents"). The Regents grant to you a nonexclusive, |
28 |
< |
nontransferable license ("License") to use Radiance source code without |
29 |
< |
fee. You may not sell or distribute Radiance to others without the |
30 |
< |
prior express written permission of The Regents. You may compile and |
31 |
< |
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. |
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 |
|
|
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 |
– |
|
33 |
|
def show_license(): |
34 |
< |
sys.stderr.write(_ltext) |
35 |
< |
sys.stderr.write( |
36 |
< |
'Do you understand and accept the terms of this agreement [n]?\n\n') |
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 |
< |
answer = '' |
46 |
< |
s = 'Please enter "yes" or "no", or use ^C to exit: ' |
47 |
< |
while answer not in ['y', 'ye', 'yes', 'n', 'no']: |
48 |
< |
if answer: sys.stderr.write('invalid input "%s"\n' % answer) |
49 |
< |
answer = string.lower(raw_input(s)) |
50 |
< |
|
45 |
< |
if answer[0] == 'y': |
46 |
< |
return |
47 |
< |
else: |
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 |
|
|