forked from snoplus/snoing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathratreleases.py
318 lines (310 loc) · 20.3 KB
/
ratreleases.py
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
#!/usr/bin/env python
#
# RatRelasePost3, RatReleasePre4, RatReleasePre3, RatReleasePre2
#
# Base classes for the various rat releases, oldest at the bottom
# RAT-2 is first curl and bzip one!
# RAT-3 adds avalanche, xerces and zeromq extra
# RAT-4 slightly changes the geant dependency
# RAT-4.2 removes zmq & avalanche dependencies
# RAT-4.5 removes xercesc and clhep dependency
#
# Author P G Jones - 21/06/2012 <[email protected]> : First revision
# Author P G Jones - 23/09/2012 <[email protected]> : Major refactor of snoing.
####################################################################################################
import os
import rat
class RatRelease6(rat.RatRelease):
""" Base installer for rat relase 6.0.0 onwards."""
def __init__(self, name, system, root_dep, tar_name, postgres=False):
""" Initlaise, take extra dependencies."""
super(RatRelease6, self).__init__(name, system, root_dep, "geant4.10.0.p02", "scons-2.3.4",
tar_name)
self._curl_dep = "curl-7.26.0"
self._bzip_dep = "bzip2-1.0.6"
self._postgres_dep = "postgresql-9.5.2"
self._require_postgres = postgres
def _get_dependencies(self):
""" Return the extra dependencies."""
if self._require_postgres is True:
return [self._curl_dep, self._bzip_dep, self._postgres_dep]
else:
return [self._curl_dep, self._bzip_dep]
def _write_env_file(self):
""" Diff geant env file and no need to patch rat."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "bin/geant4")
self._env_file.append_path(os.path.join(self._dependency_paths[self._geant_dep], "bin"))
if self._dependency_paths[self._curl_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._curl_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._curl_dep], "lib"))
if self._dependency_paths[self._bzip_dep] is not None: # Conditional Package
self._env_file.add_environment("BZIPROOT", self._dependency_paths[self._bzip_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._bzip_dep],
"lib"))
if self._require_postgres is True and self._dependency_paths[self._postgres_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._postgres_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._postgres_dep], "lib"))
class RatRelease5(rat.RatRelease):
""" Base installer for rat relase 5.0.0 onwards."""
def __init__(self, name, system, root_dep, tar_name):
""" Initlaise, take extra dependencies."""
super(RatRelease5, self).__init__(name, system, root_dep, "geant4.10.0.p02", "scons-2.1.0",
tar_name)
self._curl_dep = "curl-7.26.0"
self._bzip_dep = "bzip2-1.0.6"
def _get_dependencies(self):
""" Return the extra dependencies."""
return [self._curl_dep, self._bzip_dep]
def _write_env_file(self):
""" Diff geant env file and no need to patch rat."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "bin/geant4")
self._env_file.append_path(os.path.join(self._dependency_paths[self._geant_dep], "bin"))
if self._dependency_paths[self._curl_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._curl_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._curl_dep], "lib"))
if self._dependency_paths[self._bzip_dep] is not None: # Conditional Package
self._env_file.add_environment("BZIPROOT", self._dependency_paths[self._bzip_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._bzip_dep],
"lib"))
class RatRelease4Post4(rat.RatRelease):
""" Base installer for rat relase 4.4.0 onwards."""
def __init__(self, name, system, root_dep, tar_name):
""" Initlaise, take extra dependencies."""
super(RatRelease4Post4, self).__init__(name, system, root_dep, "geant4.9.6.p02", "scons-2.1.0",
tar_name)
self._curl_dep = "curl-7.26.0"
self._bzip_dep = "bzip2-1.0.6"
def _get_dependencies(self):
""" Return the extra dependencies."""
return [self._curl_dep, self._bzip_dep]
def _write_env_file(self):
""" Diff geant env file and no need to patch rat."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "bin/geant4")
self._env_file.append_path(os.path.join(self._dependency_paths[self._geant_dep], "bin"))
if self._dependency_paths[self._curl_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._curl_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._curl_dep], "lib"))
if self._dependency_paths[self._bzip_dep] is not None: # Conditional Package
self._env_file.add_environment("BZIPROOT", self._dependency_paths[self._bzip_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._bzip_dep],
"lib"))
class RatRelease4Post1(rat.RatRelease):
""" Base installer for rat relase 4.20 onwards."""
def __init__(self, name, system, root_dep, tar_name):
""" Initlaise, take extra dependencies."""
super(RatRelease4Post1, self).__init__(name, system, root_dep, "geant4.9.5.p01", "scons-2.1.0",
tar_name)
self._clhep_dep = "clhep-2.1.1.0"
self._curl_dep = "curl-7.26.0"
self._bzip_dep = "bzip2-1.0.6"
self._xercesc_dep = "xerces-c-3.1.1"
def _get_dependencies(self):
""" Return the extra dependencies."""
return [self._clhep_dep, self._curl_dep, self._bzip_dep, self._xercesc_dep]
def _write_env_file(self):
""" Diff geant env file and no need to patch rat."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "bin/geant4")
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._clhep_dep],
"lib"))
if self._dependency_paths[self._xercesc_dep] is not None: # Conditional Package
self._env_file.add_environment("XERCESCROOT", self._dependency_paths[self._xercesc_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._xercesc_dep],
"lib"))
self._env_file.append_path(os.path.join(self._dependency_paths[self._clhep_dep], "bin"))
self._env_file.append_path(os.path.join(self._dependency_paths[self._geant_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._clhep_dep],
"lib"))
if self._dependency_paths[self._curl_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._curl_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._curl_dep], "lib"))
if self._dependency_paths[self._bzip_dep] is not None: # Conditional Package
self._env_file.add_environment("BZIPROOT", self._dependency_paths[self._bzip_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._bzip_dep],
"lib"))
class RatRelease4Pre2(rat.RatRelease):
""" Base installer for rat release 4.00 and 4.10."""
def __init__(self, name, system, root_dep, tar_name):
""" Initlaise, take extra dependencies."""
super(RatRelease4Pre2, self).__init__(name, system, root_dep, "geant4.9.5.p01", "scons-2.1.0",
tar_name)
self._clhep_dep = "clhep-2.1.1.0"
self._curl_dep = "curl-7.26.0"
self._bzip_dep = "bzip2-1.0.6"
self._avalanche_dep = "avalanche-1"
self._zeromq_dep = "zeromq-2.2.0"
self._xercesc_dep = "xerces-c-3.1.1"
def _get_dependencies(self):
""" Return the extra dependencies."""
return [self._clhep_dep, self._curl_dep, self._bzip_dep, self._avalanche_dep,
self._zeromq_dep, self._xercesc_dep]
def _is_installed(self):
""" Rat releases and dev share a common install check."""
# Check rat, root, RATLib and RATDSLib
sys = os.uname()[0]
return self._system.file_exists('rat_%s-g++' % sys,
os.path.join(self.get_install_path(), "bin")) \
and self._system.file_exists('root',
os.path.join(self.get_install_path(), "bin")) \
and self._system.library_exists("librat_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib")) \
and self._system.library_exists("libRATEvent_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib"))
def _write_env_file(self):
""" Diff geant env file and no need to patch rat."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "bin/geant4")
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._clhep_dep],
"lib"))
self._env_file.add_environment("AVALANCHEROOT", self._dependency_paths[self._avalanche_dep])
if self._dependency_paths[self._zeromq_dep] is not None: # Conditional Package
self._env_file.add_environment("ZEROMQROOT", self._dependency_paths[self._zeromq_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._zeromq_dep],
"lib"))
if self._dependency_paths[self._xercesc_dep] is not None: # Conditional Package
self._env_file.add_environment("XERCESCROOT", self._dependency_paths[self._xercesc_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._xercesc_dep],
"lib"))
self._env_file.append_path(os.path.join(self._dependency_paths[self._clhep_dep], "bin"))
self._env_file.append_path(os.path.join(self._dependency_paths[self._geant_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._clhep_dep],
"lib"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._avalanche_dep],
"lib/cpp"))
if self._dependency_paths[self._curl_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._curl_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._curl_dep], "lib"))
if self._dependency_paths[self._bzip_dep] is not None: # Conditional Package
self._env_file.add_environment("BZIPROOT", self._dependency_paths[self._bzip_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._bzip_dep],
"lib"))
class RatRelease3(rat.RatRelease):
""" Base package installer for rat release 3."""
def __init__(self, name, system, tar_name):
""" Initlaise, take extra dependencies."""
super(RatRelease3, self).__init__(name, system, "root-5.32.04", "geant4.9.4.p01", "scons-2.1.0",
tar_name)
self._clhep_dep = "clhep-2.1.0.1"
self._curl_dep = "curl-7.26.0"
self._bzip_dep = "bzip2-1.0.6"
self._avalanche_dep = "avalanche-1"
self._zeromq_dep = "zeromq-2.2.0"
self._xercesc_dep = "xerces-c-3.1.1"
def _is_installed(self):
""" Rat releases and dev share a common install check."""
# Check rat, root, RATLib and RATDSLib
sys = os.uname()[0]
return self._system.file_exists('rat_%s-g++' % sys,
os.path.join(self.get_install_path(), "bin")) \
and self._system.file_exists('root',
os.path.join(self.get_install_path(), "bin")) \
and self._system.library_exists("librat_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib")) \
and self._system.library_exists("libRATEvent_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib"))
def _get_dependencies(self):
""" Return the extra dependencies."""
return [self._clhep_dep, self._curl_dep, self._bzip_dep, self._avalanche_dep, \
self._zeromq_dep, self._xercesc_dep]
def _write_env_file(self):
""" Add the extra info to the env file."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "env")
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._clhep_dep],
"lib"))
self._env_file.add_environment("AVALANCHEROOT", self._dependency_paths[self._avalanche_dep])
if self._dependency_paths[self._zeromq_dep] is not None: # Conditional Package
self._env_file.add_environment("ZEROMQROOT", self._dependency_paths[self._zeromq_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._zeromq_dep],
"lib"))
if self._dependency_paths[self._xercesc_dep] is not None: # Conditional Package
self._env_file.add_environment("XERCESCROOT", self._dependency_paths[self._xercesc_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._xercesc_dep],
"lib"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._avalanche_dep],
"lib/cpp"))
if self._dependency_paths[self._curl_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._curl_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._curl_dep], "lib"))
if self._dependency_paths[self._bzip_dep] is not None: # Conditional Package
self._env_file.add_environment("BZIPROOT", self._dependency_paths[self._bzip_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._bzip_dep],
"lib"))
# Must patch the rat config/EXTERNALS file if BZIPROOT is present
externals_file = open(os.path.join(self.get_install_path(), "config/EXTERNAL.scons"), "r")
text = externals_file.read()
externals_file.close()
externals_file = open(os.path.join(self.get_install_path(), "config/EXTERNAL.scons"), "w")
text = text.replace("ext_deps['bz2']['path'] = None",
"ext_deps['bz2']['path'] = os.environ['BZIPROOT']")
externals_file.write(text)
externals_file.close()
class RatRelease2(rat.RatRelease):
""" Base package installer for rat release 2."""
def __init__(self, name, system, tar_name):
""" Initlaise, take extra dependencies."""
super(RatRelease2, self).__init__(name, system, "root-5.28.00", "geant4.9.4.p01", "scons-2.1.0",
tar_name)
self._clhep_dep = "clhep-2.1.0.1"
self._curl_dep = "curl-7.26.0"
self._bzip_dep = "bzip2-1.0.6"
def _is_installed(self):
""" Rat releases and dev share a common install check."""
# Check rat, root, RATLib and RATDSLib
sys = os.uname()[0]
return self._system.file_exists('rat_%s-g++' % sys,
os.path.join(self.get_install_path(), "bin")) \
and self._system.file_exists('root',
os.path.join(self.get_install_path(), "bin")) \
and self._system.library_exists("librat_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib")) \
and self._system.library_exists("libRATEvent_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib"))
def _get_dependencies(self):
""" Return the extra dependencies."""
return [self._clhep_dep, self._curl_dep, self._bzip_dep]
def _write_env_file(self):
""" Add the extra info to the env file."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "env")
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._clhep_dep],
"lib"))
if self._dependency_paths[self._curl_dep] is not None: # Conditional Package
self._env_file.append_path(os.path.join(self._dependency_paths[self._curl_dep], "bin"))
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._curl_dep], "lib"))
if self._dependency_paths[self._bzip_dep] is not None: # Conditional Package
self._env_file.add_environment("BZIPROOT", self._dependency_paths[self._bzip_dep])
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._bzip_dep],
"lib"))
# Must patch the rat config/EXTERNALS file if BZIPROOT
externals_file = open(os.path.join(self.get_install_path(), "config/EXTERNAL.scons"), "r")
text = externals_file.read()
exterbalsFile.close()
externals_file = open(os.path.join(self.get_install_path(), "config/EXTERNAL.scons"), "w")
text = text.replace("ext_deps['bz2']['path'] = None",
"ext_deps['bz2']['path'] = os.environ['BZIPROOT']")
externals_file.write(text)
externals_file.close()
class RatRelease0and1(rat.RatRelease):
""" Base package installer for rat releases 0, 1."""
def __init__(self, name, system, tar_name):
""" Initlaise, take extra dependencies."""
super(RatRelease0and1, self).__init__(name, system, "root-5.24.00", "geant4.9.2.p02",
"scons-1.2.0", tar_name)
self._clhep_dep = "clhep-2.0.4.2"
def _is_installed(self):
""" Rat releases and dev share a common install check."""
# Check rat, root, RATLib and RATDSLib
sys = os.uname()[0]
return self._system.file_exists('rat_%s-g++' % sys,
os.path.join(self.get_install_path(), "bin")) \
and self._system.file_exists('root',
os.path.join(self.get_install_path(), "bin")) \
and self._system.library_exists("librat_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib")) \
and self._system.library_exists("libRATEvent_%s-g++" % sys,
os.path.join(self.get_install_path(), "lib"))
def _get_dependencies(self):
""" Return the extra dependencies."""
return [self._clhep_dep]
def _write_env_file(self):
""" Add the extra info to the env file."""
self._env_file.add_source(self._dependency_paths[self._geant_dep], "env")
self._env_file.append_library_path(os.path.join(self._dependency_paths[self._clhep_dep],
"lib"))