Merge lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers_dev into lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers
- HEPToolsInstallers_dev
- Merge into HEPToolsInstallers
Status: | Merged |
---|---|
Merged at revision: | 109 |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers_dev |
Merge into: | lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers |
Diff against target: |
471 lines (+200/-184) 2 files modified
HEPToolInstaller.py (+198/-183) installLHAPDF6.sh (+2/-1) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers_dev |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Valentin Hirschi | Approve | ||
Review via email: mp+362720@code.launchpad.net |
Commit message
Description of the change
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Valentin Hirschi (valentin-hirschi) wrote : | # |
> He he,
>
> I learned that you can merge multiple times the same branch...
> I guess I will merge this quickly any objection?
>
> Olivier
>
> PS: I will auto-review the change ;-)
There seem to be *a lot* of modifications which are however probably just some re-structuring an reshuffling of the various bits of HEPToolsInstall
Would you mind describing a bit your changes? Thanks!
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Note that revision 109 change a lot but at the same time,
it actually is mainly identation and adding
if "__main__" == __name__
at couple of place.
The reason is that I want to be able to do
import HEPToolsInstaller
and not run the code.
So this is in principle harmless.
Valentin Hirschi (valentin-hirschi) wrote : | # |
Ok, that's a very positive change. I like the idea of being able to use this tool both as a standalone and a python module. Thanks.
Preview Diff
1 | === modified file 'HEPToolInstaller.py' | |||
2 | --- HEPToolInstaller.py 2018-04-13 09:53:15 +0000 | |||
3 | +++ HEPToolInstaller.py 2019-02-05 10:15:18 +0000 | |||
4 | @@ -263,9 +263,6 @@ | |||
5 | 263 | # List of tools for which the tarballs have been specified | 263 | # List of tools for which the tarballs have been specified |
6 | 264 | _tarballs_specified = [] | 264 | _tarballs_specified = [] |
7 | 265 | 265 | ||
8 | 266 | if len(sys.argv)>1 and sys.argv[1].lower() not in _HepTools.keys(): | ||
9 | 267 | logger.warning("HEPToolInstaller does not support the installation of %s" , sys.argv[1]) | ||
10 | 268 | sys.argv[1] = 'help' | ||
11 | 269 | 266 | ||
12 | 270 | logger_level = [a[10:] for a in sys.argv if '--logging=' in a] | 267 | logger_level = [a[10:] for a in sys.argv if '--logging=' in a] |
13 | 271 | if not logger_level: | 268 | if not logger_level: |
14 | @@ -276,15 +273,22 @@ | |||
15 | 276 | logger_level = int(logger_level) | 273 | logger_level = int(logger_level) |
16 | 277 | else: | 274 | else: |
17 | 278 | try: | 275 | try: |
19 | 279 | logger_level = getattr(logging,logger_level) | 276 | logger_level = getattr(logging,logger_level) |
20 | 280 | except AttributeError: | 277 | except AttributeError: |
28 | 281 | print "Logging level %s not reckognized."%logger_level | 278 | print "Logging level %s not reckognized."%logger_level |
29 | 282 | sys.exit(9) | 279 | sys.exit(9) |
30 | 283 | 280 | logging.basicConfig(format='%(message)s',level=logger_level) | |
31 | 284 | logging.basicConfig(format='%(message)s',level=logger_level) | 281 | |
32 | 285 | 282 | if "__main__" == __name__: | |
33 | 286 | if len(sys.argv)<2 or sys.argv[1]=='help': | 283 | |
34 | 287 | print """ | 284 | if len(sys.argv)>1 and sys.argv[1].lower() not in _HepTools.keys(): |
35 | 285 | logger.warning("HEPToolInstaller does not support the installation of %s" , sys.argv[1]) | ||
36 | 286 | sys.argv[1] = 'help' | ||
37 | 287 | |||
38 | 288 | |||
39 | 289 | |||
40 | 290 | if len(sys.argv)<2 or sys.argv[1]=='help': | ||
41 | 291 | print """ | ||
42 | 288 | ./HEPToolInstaller <target> <options>" | 292 | ./HEPToolInstaller <target> <options>" |
43 | 289 | Possible values and meaning for the various <options> are: | 293 | Possible values and meaning for the various <options> are: |
44 | 290 | 294 | ||
45 | @@ -312,16 +316,17 @@ | |||
46 | 312 | Example of usage: | 316 | Example of usage: |
47 | 313 | ./HEPToolInstaller.py pythia8 --prefix=~/MyTools --with_lhapdf6=OFF --pythia8_tarball=~/MyTarball.tar.gz | 317 | ./HEPToolInstaller.py pythia8 --prefix=~/MyTools --with_lhapdf6=OFF --pythia8_tarball=~/MyTarball.tar.gz |
48 | 314 | """%(', '.join(_HepTools.keys()),', '.join(_non_installable_dependencies.keys())) | 318 | """%(', '.join(_HepTools.keys()),', '.join(_non_installable_dependencies.keys())) |
52 | 315 | sys.exit(9) | 319 | sys.exit(9) |
53 | 316 | 320 | ||
54 | 317 | target_tool = sys.argv[1].lower() | 321 | target_tool = sys.argv[1].lower() |
55 | 322 | |||
56 | 318 | 323 | ||
57 | 319 | # Make sure to set the install location of all other tools than the target to 'default'. Meaning that they | 324 | # Make sure to set the install location of all other tools than the target to 'default'. Meaning that they |
58 | 320 | # will be installed if not found. | 325 | # will be installed if not found. |
63 | 321 | for tool in _HepTools: | 326 | for tool in _HepTools: |
64 | 322 | if tool==target_tool: | 327 | if tool==target_tool: |
65 | 323 | continue | 328 | continue |
66 | 324 | _HepTools[tool]['install_path']='default' | 329 | _HepTools[tool]['install_path']='default' |
67 | 325 | 330 | ||
68 | 326 | 331 | ||
69 | 327 | # For compatibility reason, map some names | 332 | # For compatibility reason, map some names |
70 | @@ -336,9 +341,10 @@ | |||
71 | 336 | ['--veto_%s'%tool for tool in _HepTools.keys()+_non_installable_dependencies.keys()]+\ | 341 | ['--veto_%s'%tool for tool in _HepTools.keys()+_non_installable_dependencies.keys()]+\ |
72 | 337 | ['--logging','--source', '--version'] | 342 | ['--logging','--source', '--version'] |
73 | 338 | 343 | ||
77 | 339 | # Recall input command for logfiles | 344 | if '__main__' == __name__: |
78 | 340 | logger.debug("Installer HEPToolInstaller.py is now processing the following command:") | 345 | # Recall input command for logfiles |
79 | 341 | logger.debug(" %s"%' '.join(sys.argv)) | 346 | logger.debug("Installer HEPToolInstaller.py is now processing the following command:") |
80 | 347 | logger.debug(" %s"%' '.join(sys.argv)) | ||
81 | 342 | 348 | ||
82 | 343 | def with_option_parser(with_option): | 349 | def with_option_parser(with_option): |
83 | 344 | if with_option=='ON': | 350 | if with_option=='ON': |
84 | @@ -363,140 +369,141 @@ | |||
85 | 363 | tool_options['tarball'] = tarball_specifier | 369 | tool_options['tarball'] = tarball_specifier |
86 | 364 | break | 370 | break |
87 | 365 | 371 | ||
131 | 366 | _version = None | 372 | if '__main__' == __name__: |
132 | 367 | # Now parse the options | 373 | _version = None |
133 | 368 | for user_option in sys.argv[2:]: | 374 | # Now parse the options |
134 | 369 | try: | 375 | for user_option in sys.argv[2:]: |
92 | 370 | option, value = user_option.split('=') | ||
93 | 371 | except: | ||
94 | 372 | option = user_option | ||
95 | 373 | value = None | ||
96 | 374 | if option not in available_options: | ||
97 | 375 | logger.error("Option '%s' not reckognized." , option) | ||
98 | 376 | sys.exit(9) | ||
99 | 377 | if option=='--force': | ||
100 | 378 | _overwrite_existing_installation = True | ||
101 | 379 | if option=='--update': | ||
102 | 380 | supported_tools = ['madanalysis5'] | ||
103 | 381 | if target_tool not in supported_tools: | ||
104 | 382 | logger.error("HEPToolsInstaller.py supports the option '--update' only for the following tools:") | ||
105 | 383 | logger.error(" %s"%supported_tools) | ||
106 | 384 | sys.exit(9) | ||
107 | 385 | _keep_existing_installation = True | ||
108 | 386 | if option=='--keep_source': | ||
109 | 387 | _keep_source = True | ||
110 | 388 | if option=='--prefix': | ||
111 | 389 | if not os.path.isdir(value): | ||
112 | 390 | logger.info("Creating root directory '%s'.", os.path.abspath(value)) | ||
113 | 391 | os.mkdir(os.path.abspath(value)) | ||
114 | 392 | _prefix = os.path.abspath(value) | ||
115 | 393 | elif option=='--fortran_compiler': | ||
116 | 394 | _gfortran = value | ||
117 | 395 | elif option=='--cpp_compiler': | ||
118 | 396 | _cpp = value | ||
119 | 397 | elif option=='--no_MA5_further_install': | ||
120 | 398 | _HepTools['madanalysis5']['MA5_further_install']=False | ||
121 | 399 | elif option=='--no_root_in_MA5': | ||
122 | 400 | _HepTools['madanalysis5']['use_root_if_available']=False | ||
123 | 401 | elif option=='--cpp_standard_lib': | ||
124 | 402 | if value not in ['-lc++','-lstdc++']: | ||
125 | 403 | logger.error( "ERROR: Option '--cpp_standard_lib' must be either '-lc++' or '-libstdc++', not '%s'.", value) | ||
126 | 404 | sys.exit(9) | ||
127 | 405 | _cpp_standard_lib = value | ||
128 | 406 | elif option=='--mg5_path': | ||
129 | 407 | _mg5_path = value | ||
130 | 408 | # Try to gather MG5_version | ||
135 | 409 | try: | 376 | try: |
141 | 410 | _mg5_version = None | 377 | option, value = user_option.split('=') |
137 | 411 | for line in open(pjoin(_mg5_path,'VERSION'),'r').read().split('\n'): | ||
138 | 412 | if line.startswith('version ='): | ||
139 | 413 | _mg5_version = LooseVersion(line[9:].strip()) | ||
140 | 414 | break | ||
142 | 415 | except: | 378 | except: |
216 | 416 | raise | 379 | option = user_option |
217 | 417 | _mg5_version = None | 380 | value = None |
218 | 418 | elif option.startswith('--with_'): | 381 | if option not in available_options: |
219 | 419 | dependency_name = _dependency_names_map[option[7:]] if option[7:] in _dependency_names_map else option[7:] | 382 | logger.error("Option '%s' not reckognized." , option) |
220 | 420 | value = with_option_parser(value) | 383 | sys.exit(9) |
221 | 421 | if dependency_name in _HepTools: | 384 | if option=='--force': |
222 | 422 | _HepTools[dependency_name]['install_path'] = value | 385 | _overwrite_existing_installation = True |
223 | 423 | else: | 386 | if option=='--update': |
224 | 424 | # Special treatment for dependencies that cannot be directly installed in this installer | 387 | supported_tools = ['madanalysis5'] |
225 | 425 | _non_installable_dependencies[dependency_name]['path'] = value if (value not in ['Default',False, None]) else None | 388 | if target_tool not in supported_tools: |
226 | 426 | _non_installable_dependencies[dependency_name]['active'] = (value!=False) | 389 | logger.error("HEPToolsInstaller.py supports the option '--update' only for the following tools:") |
227 | 427 | elif option.startswith('--veto_'): | 390 | logger.error(" %s"%supported_tools) |
228 | 428 | dependency_name = option[7:] | 391 | sys.exit(9) |
229 | 429 | if dependency_name in _HepTools: | 392 | _keep_existing_installation = True |
230 | 430 | _HepTools[dependency_name]['install_path'] = None | 393 | if option=='--keep_source': |
231 | 431 | else: | 394 | _keep_source = True |
232 | 432 | # Special treatment for dependencies that cannot be directly installed in this installer | 395 | if option=='--prefix': |
233 | 433 | _non_installable_dependencies[dependency_name]['path'] = None | 396 | if not os.path.isdir(value): |
234 | 434 | _non_installable_dependencies[dependency_name]['active'] = False | 397 | logger.info("Creating root directory '%s'.", os.path.abspath(value)) |
235 | 435 | 398 | os.mkdir(os.path.abspath(value)) | |
236 | 436 | elif option.endswith('_tarball'): | 399 | _prefix = os.path.abspath(value) |
237 | 437 | access_mode = 'online' if '//' in value else 'local' | 400 | elif option=='--fortran_compiler': |
238 | 438 | if access_mode=='local': | 401 | _gfortran = value |
239 | 439 | value = os.path.abspath(value) | 402 | elif option=='--cpp_compiler': |
240 | 440 | _HepTools[option[2:-8]]['tarball'] = [access_mode, value] | 403 | _cpp = value |
241 | 441 | # Flag the tarball of this tool as specified | 404 | elif option=='--no_MA5_further_install': |
242 | 442 | _tarballs_specified.append(option[2:-8]) | 405 | _HepTools['madanalysis5']['MA5_further_install']=False |
243 | 443 | elif option.startswith('--version='): | 406 | elif option=='--no_root_in_MA5': |
244 | 444 | _version = value | 407 | _HepTools['madanalysis5']['use_root_if_available']=False |
245 | 445 | 408 | elif option=='--cpp_standard_lib': | |
246 | 446 | 409 | if value not in ['-lc++','-lstdc++']: | |
247 | 447 | # Adapt paths according to MG5 version specified | 410 | logger.error( "ERROR: Option '--cpp_standard_lib' must be either '-lc++' or '-libstdc++', not '%s'.", value) |
248 | 448 | if _mg5_version: | 411 | sys.exit(9) |
249 | 449 | adapt_tarball_paths_according_to_MG5_version(_mg5_version) | 412 | _cpp_standard_lib = value |
250 | 450 | 413 | elif option=='--mg5_path': | |
251 | 451 | # force code version if request by the user | 414 | _mg5_path = value |
252 | 452 | if _version: | 415 | # Try to gather MG5_version |
253 | 453 | if 'format_version' in _HepTools[target_tool]: | 416 | try: |
254 | 454 | _version = _HepTools[target_tool]['format_version'](_version) | 417 | _mg5_version = None |
255 | 455 | if '%(version)s' in _HepTools[target_tool]['tarball'][1]: | 418 | for line in open(pjoin(_mg5_path,'VERSION'),'r').read().split('\n'): |
256 | 456 | _HepTools[target_tool]['tarball'][1]=_HepTools[target_tool]['tarball'][1]%{'version':_version} | 419 | if line.startswith('version ='): |
257 | 457 | else: | 420 | _mg5_version = LooseVersion(line[9:].strip()) |
258 | 458 | raise Exception, 'fail to specify version for this tools.' | 421 | break |
259 | 459 | 422 | except: | |
260 | 460 | # Apply substitutions if necessary: | 423 | raise |
261 | 461 | 424 | _mg5_version = None | |
262 | 462 | for tool in _HepTools: | 425 | elif option.startswith('--with_'): |
263 | 463 | if _HepTools[tool]['install_path']: | 426 | dependency_name = _dependency_names_map[option[7:]] if option[7:] in _dependency_names_map else option[7:] |
264 | 464 | _HepTools[tool]['install_path']=_HepTools[tool]['install_path']%\ | 427 | value = with_option_parser(value) |
265 | 465 | {'prefix':_prefix, 'mg5_path': '' if _mg5_path is None else _mg5_path } | 428 | if dependency_name in _HepTools: |
266 | 466 | if _HepTools[tool]['tarball'][0]=='local': | 429 | _HepTools[dependency_name]['install_path'] = value |
267 | 467 | _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%\ | 430 | else: |
268 | 468 | {'prefix':_prefix, 'mg5_path': '' if _mg5_path is None else _mg5_path } | 431 | # Special treatment for dependencies that cannot be directly installed in this installer |
269 | 469 | 432 | _non_installable_dependencies[dependency_name]['path'] = value if (value not in ['Default',False, None]) else None | |
270 | 470 | if _HepTools[tool]['tarball'][0]=='online': | 433 | _non_installable_dependencies[dependency_name]['active'] = (value!=False) |
271 | 471 | version = _HepTools[tool]['version'] | 434 | elif option.startswith('--veto_'): |
272 | 472 | if 'format_version' in _HepTools[tool]: | 435 | dependency_name = option[7:] |
273 | 473 | version = _HepTools[tool]['format_version'](version) | 436 | if dependency_name in _HepTools: |
274 | 474 | _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%{'version':version} | 437 | _HepTools[dependency_name]['install_path'] = None |
275 | 475 | 438 | else: | |
276 | 476 | new_libs = [] | 439 | # Special treatment for dependencies that cannot be directly installed in this installer |
277 | 477 | for lib in _HepTools[tool]['libraries']: | 440 | _non_installable_dependencies[dependency_name]['path'] = None |
278 | 478 | for libext in _lib_extensions: | 441 | _non_installable_dependencies[dependency_name]['active'] = False |
279 | 479 | if lib%{'libextension':libext} not in new_libs: | 442 | |
280 | 480 | new_libs.append(lib%{'libextension':libext}) | 443 | elif option.endswith('_tarball'): |
281 | 481 | _HepTools[tool]['libraries'] = new_libs | 444 | access_mode = 'online' if '//' in value else 'local' |
282 | 482 | 445 | if access_mode=='local': | |
283 | 483 | 446 | value = os.path.abspath(value) | |
284 | 484 | # Make sure it is not already installed, but if the directory is empty, then remove it | 447 | _HepTools[option[2:-8]]['tarball'] = [access_mode, value] |
285 | 485 | if os.path.isdir(pjoin(_prefix,target_tool)): | 448 | # Flag the tarball of this tool as specified |
286 | 486 | if os.listdir(pjoin(_prefix,target_tool)) in [[],['%s_install.log'%target_tool]]: | 449 | _tarballs_specified.append(option[2:-8]) |
287 | 487 | shutil.rmtree(pjoin(_prefix,target_tool)) | 450 | elif option.startswith('--version='): |
288 | 488 | _keep_existing_installation = False | 451 | _version = value |
289 | 452 | |||
290 | 453 | |||
291 | 454 | # Adapt paths according to MG5 version specified | ||
292 | 455 | if _mg5_version: | ||
293 | 456 | adapt_tarball_paths_according_to_MG5_version(_mg5_version) | ||
294 | 457 | |||
295 | 458 | # force code version if request by the user | ||
296 | 459 | if _version: | ||
297 | 460 | if 'format_version' in _HepTools[target_tool]: | ||
298 | 461 | _version = _HepTools[target_tool]['format_version'](_version) | ||
299 | 462 | if '%(version)s' in _HepTools[target_tool]['tarball'][1]: | ||
300 | 463 | _HepTools[target_tool]['tarball'][1]=_HepTools[target_tool]['tarball'][1]%{'version':_version} | ||
301 | 464 | else: | ||
302 | 465 | raise Exception, 'fail to specify version for this tools.' | ||
303 | 466 | |||
304 | 467 | # Apply substitutions if necessary: | ||
305 | 468 | |||
306 | 469 | for tool in _HepTools: | ||
307 | 470 | if _HepTools[tool]['install_path']: | ||
308 | 471 | _HepTools[tool]['install_path']=_HepTools[tool]['install_path']%\ | ||
309 | 472 | {'prefix':_prefix, 'mg5_path': '' if _mg5_path is None else _mg5_path } | ||
310 | 473 | if _HepTools[tool]['tarball'][0]=='local': | ||
311 | 474 | _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%\ | ||
312 | 475 | {'prefix':_prefix, 'mg5_path': '' if _mg5_path is None else _mg5_path } | ||
313 | 476 | |||
314 | 477 | if _HepTools[tool]['tarball'][0]=='online': | ||
315 | 478 | version = _HepTools[tool]['version'] | ||
316 | 479 | if 'format_version' in _HepTools[tool]: | ||
317 | 480 | version = _HepTools[tool]['format_version'](version) | ||
318 | 481 | _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%{'version':version} | ||
319 | 482 | |||
320 | 483 | new_libs = [] | ||
321 | 484 | for lib in _HepTools[tool]['libraries']: | ||
322 | 485 | for libext in _lib_extensions: | ||
323 | 486 | if lib%{'libextension':libext} not in new_libs: | ||
324 | 487 | new_libs.append(lib%{'libextension':libext}) | ||
325 | 488 | _HepTools[tool]['libraries'] = new_libs | ||
326 | 489 | |||
327 | 490 | |||
328 | 491 | # Make sure it is not already installed, but if the directory is empty, then remove it | ||
329 | 492 | if os.path.isdir(pjoin(_prefix,target_tool)): | ||
330 | 493 | if os.listdir(pjoin(_prefix,target_tool)) in [[],['%s_install.log'%target_tool]]: | ||
331 | 494 | shutil.rmtree(pjoin(_prefix,target_tool)) | ||
332 | 495 | _keep_existing_installation = False | ||
333 | 496 | else: | ||
334 | 497 | if not _keep_existing_installation: | ||
335 | 498 | if not _overwrite_existing_installation: | ||
336 | 499 | logger.warning( "The specified path '%s' already contains an installation of tool '%s'.", _prefix, target_tool) | ||
337 | 500 | logger.warning( "Rerun the HEPToolInstaller.py script again with the option '--force' if you want to overwrite it.") | ||
338 | 501 | sys.exit(66) | ||
339 | 502 | else: | ||
340 | 503 | logger.info("Removing existing installation of tool '%s' in '%s'.", target_tool, _prefix) | ||
341 | 504 | shutil.rmtree(pjoin(_prefix,target_tool)) | ||
342 | 489 | else: | 505 | else: |
353 | 490 | if not _keep_existing_installation: | 506 | _keep_existing_installation = False |
344 | 491 | if not _overwrite_existing_installation: | ||
345 | 492 | logger.warning( "The specified path '%s' already contains an installation of tool '%s'.", _prefix, target_tool) | ||
346 | 493 | logger.warning( "Rerun the HEPToolInstaller.py script again with the option '--force' if you want to overwrite it.") | ||
347 | 494 | sys.exit(66) | ||
348 | 495 | else: | ||
349 | 496 | logger.info("Removing existing installation of tool '%s' in '%s'.", target_tool, _prefix) | ||
350 | 497 | shutil.rmtree(pjoin(_prefix,target_tool)) | ||
351 | 498 | else: | ||
352 | 499 | _keep_existing_installation = False | ||
354 | 500 | 507 | ||
355 | 501 | # TMP_directory (designed to work as with statement) and go to it | 508 | # TMP_directory (designed to work as with statement) and go to it |
356 | 502 | class TMP_directory(object): | 509 | class TMP_directory(object): |
357 | @@ -681,11 +688,17 @@ | |||
358 | 681 | def install_lhapdf6(tmp_path): | 688 | def install_lhapdf6(tmp_path): |
359 | 682 | """Installation operations for lhapdf6""" | 689 | """Installation operations for lhapdf6""" |
360 | 683 | lhapdf6_log = open(pjoin(_HepTools['lhapdf6']['install_path'],"lhapdf6_install.log"), "w") | 690 | lhapdf6_log = open(pjoin(_HepTools['lhapdf6']['install_path'],"lhapdf6_install.log"), "w") |
361 | 691 | cxx_flags = '-O' | ||
362 | 692 | for flag in ['-static-libstdc++']: | ||
363 | 693 | if test_cpp_compiler([flag]): | ||
364 | 694 | cxx_flags = flag | ||
365 | 695 | |||
366 | 684 | subprocess.call([pjoin(_installers_path,'installLHAPDF6.sh'), | 696 | subprocess.call([pjoin(_installers_path,'installLHAPDF6.sh'), |
367 | 685 | _HepTools['boost']['install_path'], | 697 | _HepTools['boost']['install_path'], |
368 | 686 | _HepTools['lhapdf6']['install_path'], | 698 | _HepTools['lhapdf6']['install_path'], |
369 | 687 | _HepTools['lhapdf6']['version'], | 699 | _HepTools['lhapdf6']['version'], |
371 | 688 | _HepTools['lhapdf6']['tarball'][1]], | 700 | _HepTools['lhapdf6']['tarball'][1], |
372 | 701 | cxx_flags], | ||
373 | 689 | stdout=lhapdf6_log, | 702 | stdout=lhapdf6_log, |
374 | 690 | stderr=lhapdf6_log) | 703 | stderr=lhapdf6_log) |
375 | 691 | lhapdf6_log.close() | 704 | lhapdf6_log.close() |
376 | @@ -765,7 +778,7 @@ | |||
377 | 765 | 778 | ||
378 | 766 | # Run the installation script | 779 | # Run the installation script |
379 | 767 | mg5amc_py8_interface_log = open(pjoin(_HepTools['mg5amc_py8_interface']['install_path'],"mg5amc_py8_interface_install.log"), "w") | 780 | mg5amc_py8_interface_log = open(pjoin(_HepTools['mg5amc_py8_interface']['install_path'],"mg5amc_py8_interface_install.log"), "w") |
381 | 768 | subprocess.call([pjoin(sys.executable, _HepTools['mg5amc_py8_interface']['install_path'],'compile.py')]+options, | 781 | subprocess.call([sys.executable, pjoin(_HepTools['mg5amc_py8_interface']['install_path'],'compile.py')]+options, |
382 | 769 | stdout=mg5amc_py8_interface_log, | 782 | stdout=mg5amc_py8_interface_log, |
383 | 770 | stderr=mg5amc_py8_interface_log) | 783 | stderr=mg5amc_py8_interface_log) |
384 | 771 | mg5amc_py8_interface_log.close() | 784 | mg5amc_py8_interface_log.close() |
385 | @@ -1307,34 +1320,36 @@ | |||
386 | 1307 | logger.info(" > Now aborting installation of tool '%s'."%target_tool) | 1320 | logger.info(" > Now aborting installation of tool '%s'."%target_tool) |
387 | 1308 | sys.exit(9) | 1321 | sys.exit(9) |
388 | 1309 | 1322 | ||
397 | 1310 | _environ = dict(os.environ) | 1323 | |
398 | 1311 | try: | 1324 | if "__main__" == __name__: |
399 | 1312 | os.environ["CXX"] = _cpp | 1325 | _environ = dict(os.environ) |
400 | 1313 | os.environ["FC"] = _gfortran | 1326 | try: |
401 | 1314 | # Also add the bin directory of the HEPTools install location, as we might need some of the executables installed there like cmake | 1327 | os.environ["CXX"] = _cpp |
402 | 1315 | os.environ["PATH"] = pjoin(_prefix,'bin')+os.pathsep+os.environ["PATH"] | 1328 | os.environ["FC"] = _gfortran |
403 | 1316 | install_with_dependencies(target_tool,is_main_target=True) | 1329 | # Also add the bin directory of the HEPTools install location, as we might need some of the executables installed there like cmake |
404 | 1317 | except ZeroDivisionError as e: | 1330 | os.environ["PATH"] = pjoin(_prefix,'bin')+os.pathsep+os.environ["PATH"] |
405 | 1331 | install_with_dependencies(target_tool,is_main_target=True) | ||
406 | 1332 | except ZeroDivisionError as e: | ||
407 | 1333 | os.environ.clear() | ||
408 | 1334 | os.environ.update(_environ) | ||
409 | 1335 | logger.critical("The following error occured during the installation of '%s' (and its dependencies):\n%s"%(target_tool,repr(e))) | ||
410 | 1336 | sys.exit(9) | ||
411 | 1337 | |||
412 | 1318 | os.environ.clear() | 1338 | os.environ.clear() |
413 | 1319 | os.environ.update(_environ) | 1339 | os.environ.update(_environ) |
435 | 1320 | logger.critical("The following error occured during the installation of '%s' (and its dependencies):\n%s"%(target_tool,repr(e))) | 1340 | |
436 | 1321 | sys.exit(9) | 1341 | if check_successful_installation(target_tool): |
437 | 1322 | 1342 | # Successful installation, now copy the installed components directly under HEPTools | |
438 | 1323 | os.environ.clear() | 1343 | finalize_installation(target_tool) |
439 | 1324 | os.environ.update(_environ) | 1344 | logger.info("Successful installation of '%s' in '%s'."%(target_tool,_prefix)) |
440 | 1325 | 1345 | logger.debug("See installation log at '%s'."%pjoin(_HepTools[target_tool]['install_path'],'%s_install.log'%target_tool)) | |
441 | 1326 | if check_successful_installation(target_tool): | 1346 | sys.exit(0) |
442 | 1327 | # Successful installation, now copy the installed components directly under HEPTools | 1347 | else: |
443 | 1328 | finalize_installation(target_tool) | 1348 | logger.warning("A problem occured during the installation of '%s'.", target_tool) |
444 | 1329 | logger.info("Successful installation of '%s' in '%s'."%(target_tool,_prefix)) | 1349 | try: |
445 | 1330 | logger.debug("See installation log at '%s'."%pjoin(_HepTools[target_tool]['install_path'],'%s_install.log'%target_tool)) | 1350 | logger.warning("Content of the installation log file '%s':\n\n%s"%(\ |
446 | 1331 | sys.exit(0) | 1351 | pjoin(_HepTools[target_tool]['install_path'],'%s_install.log'%target_tool), |
447 | 1332 | else: | 1352 | open(pjoin(_HepTools[target_tool]['install_path'],'%s_install.log'%target_tool),'r').read())) |
448 | 1333 | logger.warning("A problem occured during the installation of '%s'.", target_tool) | 1353 | except IOError: |
449 | 1334 | try: | 1354 | logger.warning("No additional information on the installation problem available.") |
450 | 1335 | logger.warning("Content of the installation log file '%s':\n\n%s"%(\ | 1355 | sys.exit(9) |
430 | 1336 | pjoin(_HepTools[target_tool]['install_path'],'%s_install.log'%target_tool), | ||
431 | 1337 | open(pjoin(_HepTools[target_tool]['install_path'],'%s_install.log'%target_tool),'r').read())) | ||
432 | 1338 | except IOError: | ||
433 | 1339 | logger.warning("No additional information on the installation problem available.") | ||
434 | 1340 | sys.exit(9) | ||
451 | 1341 | 1356 | ||
452 | === modified file 'installLHAPDF6.sh' | |||
453 | --- installLHAPDF6.sh 2016-04-20 19:10:54 +0000 | |||
454 | +++ installLHAPDF6.sh 2019-02-05 10:15:18 +0000 | |||
455 | @@ -10,6 +10,7 @@ | |||
456 | 10 | INSTALLD="$2" | 10 | INSTALLD="$2" |
457 | 11 | VERSION="$3" | 11 | VERSION="$3" |
458 | 12 | TARBALL="$4" | 12 | TARBALL="$4" |
459 | 13 | CXXFLAGS="$5" | ||
460 | 13 | LOCAL=$INSTALLD | 14 | LOCAL=$INSTALLD |
461 | 14 | 15 | ||
462 | 15 | # set SLC5 platform name: | 16 | # set SLC5 platform name: |
463 | @@ -32,7 +33,7 @@ | |||
464 | 32 | cd LHAPDF-${VERSION}/ | 33 | cd LHAPDF-${VERSION}/ |
465 | 33 | 34 | ||
466 | 34 | echo " Configure LHAPDF" | 35 | echo " Configure LHAPDF" |
468 | 35 | LIBRARY_PATH=$LD_LIBRARY_PATH ./configure CXXFLAGS="-static-libstdc++" --prefix=$LOCAL --bindir=$LOCAL/bin --datadir=$LOCAL/share --libdir=$LOCAL/lib --with-boost=$BOOST --enable-static | 36 | LIBRARY_PATH=$LD_LIBRARY_PATH ./configure CXXFLAGS="$CXXFLAGS" --prefix=$LOCAL --bindir=$LOCAL/bin --datadir=$LOCAL/share --libdir=$LOCAL/lib --with-boost=$BOOST --enable-static |
469 | 36 | 37 | ||
470 | 37 | echo " Compile LHAPDF6" | 38 | echo " Compile LHAPDF6" |
471 | 38 | LIBRARY_PATH=$LD_LIBRARY_PATH make | 39 | LIBRARY_PATH=$LD_LIBRARY_PATH make |
He he,
I learned that you can merge multiple times the same branch...
I guess I will merge this quickly any objection?
Olivier
PS: I will auto-review the change ;-)