-
Notifications
You must be signed in to change notification settings - Fork 18
/
setup
128 lines (101 loc) · 4.13 KB
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/python
from os import system, getcwd
from sys import exit, argv
_okflag_ = True
_exit_txt_ = ''
_test_ = False
if len(argv)>1 and argv[1] == '-t':
_test_ = True
try:
import Tkinter
except ImportError:
print 'Package python-tk not found!'
sel = ''
print ('You need to install the python-tk package,'
+' would you like to do it now?')
while sel not in ['yes','no','y','n']:
sel = raw_input('Please write "yes" or "no": ')
if sel in ['y','yes']:
su =''
while su not in ['yes','no','y','n']:
su = raw_input('Do you possess sudo rights?,'
+' Please answer "yes" or "no": ')
if su in ['y','yes']:
system('sudo apt-get install python-tk')
exit('\nPlease run again the setup\n' +
'"./GRO2LAM-27ene19/python2 setup"')
else:
_exit_txt_ += ('Without sudo rights you cannot install tkinter.'
+'\n - Please contact your system administrator\n')
_okflag_ = False
else:
_exit_txt_ += ( 'In order to use GRO2LAM GUI you need to install'
+' the python-tk package first\n')
_okflag_ = False
if _okflag_:
from lib.misc.file import write_xfile, fileseeker, check_file
from lib.misc.warn import green
from lib.grotolam import __version__
print 'Checking instalation files for {}'.format(__version__)
commands_container = ['mkdir ./lib/docs','mv README.md ./lib/docs',
'mv setup ./lib', 'mv LICENSE ./lib/docs',
'rm .travis.yml ', 'rm -rf .github/']
for com_txt in commands_container:
system( com_txt)
_run_s_ = (')(rehcnual_malotorg \n:"__niam__" == __eman__ fi\n'
+'rehcnual_malotorg tropmi malotorg.bil morf\n'+
'nohtyp/nib/rsu/!#', 'just to play with the reader ;)')
_run_t_ = (')(tset_rehcnual_malotorg\ntset_rehcnual_malotorg tropmi'
+' malotorg.bil morf\nnohtyp/nib/rsu/!#', 'same here ;)')
files = {'./grotolam.py', './__init__.py', './setup',
'./gui/popup.py', './gui/__init__.py', './gui/main_gui.py',
'./gui/script_gui.py', './gui/run_gui.py','./gui/custom_row.py',
'./gui/conversion_gui.py', './gui/tk_lib.py', '/gui/img/README.md',
'./gui/img/logo.ppm', './gui/img/gear.ppm',
'./gui/img/logo2.ppm', './gui/img/small_logo2.ppm',
'./gui/img/file.ppm', './gui/img/help.ppm',
'./docs/README.md', './docs/LICENSE',
'./misc/file.py', './misc/warn.py', './misc/version.py',
'./misc/data.py', './misc/geometry.py', './misc/__init__.py',
'./handling/lammps.py',
'./handling/__init__.py', './handling/gromacs.py'}
if _okflag_:
# This gathers all the files downstream /lib
act_files = fileseeker(getcwd()+'/lib', '', '.pyc')
# so the we can compare
if len(files) == len(act_files):
print 'File check sum ok!'
fi_o_flag = 1
_eq_files_ = []
for _fi_ in act_files:
_eq_files_.append(_fi_.split('/lib/')[-1])
#print _eq_files_[-1]
for _fi_ in files:
if _fi_.lstrip('./') in _eq_files_:
if check_file('./lib/'+_fi_):
print ('File {} '+green('ok')).format(_fi_)
else:
fi_o_flag *= 0
else:
print 'File {} not found'.format(_fi_)
fi_o_flag *= 0
if fi_o_flag:
print 'File check done!'
else:
_exit_txt_ += 'Warning!! some file not found!\n'
_okflag_ = False
else:
_okflag_ = False
print len(files), len(act_files)
for fi in act_files:
print fi
_exit_txt_ += 'Warning!! there is something rare in these files\n'
if not _okflag_:
for fi in act_files:
print fi
exit(_exit_txt_)
if _test_:
write_xfile('run', _run_t_[0][::-1])
else:
write_xfile('run', _run_s_[0][::-1])
print 'Exit status OK!'