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