Merge lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers_dev into lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 105
Proposed branch: lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers_dev
Merge into: lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers
Diff against target: 398 lines (+309/-3)
5 files modified
HEPToolInstaller.py (+103/-3)
installdragon.sh (+61/-0)
installdragondata.sh (+32/-0)
installfitsio.sh (+64/-0)
installgsl.sh (+49/-0)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers_dev
Reviewer Review Type Date Requested Status
Valentin Hirschi Approve
Review via email: mp+343231@code.launchpad.net

Commit message

Adding code for dragon and dragon_data
(+ add an option to force the version

To post a comment you must log in.
Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :

Skype P2P reviewed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'HEPToolInstaller.py'
--- HEPToolInstaller.py 2018-04-05 10:59:01 +0000
+++ HEPToolInstaller.py 2018-04-13 18:55:59 +0000
@@ -44,6 +44,39 @@
44 'libraries' : ['libboost_system-mt.%(libextension)s','libboost_system.%(libextension)s'],44 'libraries' : ['libboost_system-mt.%(libextension)s','libboost_system.%(libextension)s'],
45 'include_path' : ['/opt/local/include', '/usr/local/include', '/opt/include', '/usr/include'], 45 'include_path' : ['/opt/local/include', '/usr/local/include', '/opt/include', '/usr/include'],
46 'install_path': '%(prefix)s/boost/'},46 'install_path': '%(prefix)s/boost/'},
47 'gsl':{'install_mode':'Default',
48 'version': '2.4',
49 'tarball': ['online', 'http://mirror.ibcp.fr/pub/gnu/gsl/gsl-%(version)s.tar.gz'],
50 'mandatory_dependencies': [],
51 'optional_dependencies' : [],
52 'libraries' : ['libgsl.%(libextension)s'],
53 'include_path' : [],
54 'install_path': '%(prefix)s/GSL/'},
55 'fitsio':{'install_mode':'Default',
56 'version': '3.430',
57 'format_version': lambda x: x.replace('.',''),
58 'tarball': ['online', 'http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio%(version)s.tar.gz'],
59 'mandatory_dependencies': [],
60 'optional_dependencies' : [],
61 'libraries' : ['libcfitsio.%(libextension)s'],
62 'include_path' : [],
63 'install_path': '%(prefix)s/fitsio/'},
64 'dragon_data':{'install_mode':'Default',
65 'version': '1.0',
66 'tarball': ['online', 'http://madgraph.phys.ucl.ac.be/Downloads/maddm/dragon_input_from_galprop.zip'],
67 'mandatory_dependencies': ['dragon', 'gsl', 'fitsio'],
68 'optional_dependencies' : [],
69 'libraries' : [],
70 'include_path' : [],
71 'install_path': '%(prefix)s/dragon/'},
72 'dragon':{'install_mode':'Default',
73 'version': '1.0',
74 'tarball': ['online', 'https://github.com/cosmicrays/DRAGON/archive/master.zip'],
75 'mandatory_dependencies': ['gsl', 'fitsio'],
76 'optional_dependencies' : [],
77 'libraries' : ['libDRAGON.a'],
78 'include_path' : [],
79 'install_path': '%(prefix)s/dragon/'},
47 'rosetta':80 'rosetta':
48 {'install_mode':'Default',81 {'install_mode':'Default',
49 'version': '1.0',82 'version': '1.0',
@@ -272,6 +305,7 @@
272 | --<TOOL>_tarball=<path> | A path to .tar.gz | Path of the tarball to be used if DEP is installed305 | --<TOOL>_tarball=<path> | A path to .tar.gz | Path of the tarball to be used if DEP is installed
273 | --keep_source | - | If specified, the installer will keep the source file306 | --keep_source | - | If specified, the installer will keep the source file
274 | --logging=<int> | integer | string | Logging level for the installer. 10 is DEBUG307 | --logging=<int> | integer | string | Logging level for the installer. 10 is DEBUG
308 | --version=<str> | string | Try to force a specific version of the tool (best try)
275 -============================-====================-===================================================309 -============================-====================-===================================================
276 <TOOL> can be any of the following :\n %s\n310 <TOOL> can be any of the following :\n %s\n
277 <DEP> can be <TOOL> but also :\n %s\n311 <DEP> can be <TOOL> but also :\n %s\n
@@ -300,7 +334,7 @@
300 ['--with_%s'%tool for tool in _HepTools.keys()+_non_installable_dependencies.keys()+334 ['--with_%s'%tool for tool in _HepTools.keys()+_non_installable_dependencies.keys()+
301 _dependency_names_map.keys()]+\335 _dependency_names_map.keys()]+\
302 ['--veto_%s'%tool for tool in _HepTools.keys()+_non_installable_dependencies.keys()]+\336 ['--veto_%s'%tool for tool in _HepTools.keys()+_non_installable_dependencies.keys()]+\
303 ['--logging','--source']337 ['--logging','--source', '--version']
304338
305# Recall input command for logfiles339# Recall input command for logfiles
306logger.debug("Installer HEPToolInstaller.py is now processing the following command:")340logger.debug("Installer HEPToolInstaller.py is now processing the following command:")
@@ -329,6 +363,7 @@
329 tool_options['tarball'] = tarball_specifier363 tool_options['tarball'] = tarball_specifier
330 break364 break
331365
366_version = None
332# Now parse the options367# Now parse the options
333for user_option in sys.argv[2:]:368for user_option in sys.argv[2:]:
334 try:369 try:
@@ -404,13 +439,24 @@
404 value = os.path.abspath(value)439 value = os.path.abspath(value)
405 _HepTools[option[2:-8]]['tarball'] = [access_mode, value]440 _HepTools[option[2:-8]]['tarball'] = [access_mode, value]
406 # Flag the tarball of this tool as specified441 # Flag the tarball of this tool as specified
407 _tarballs_specified.append(option[2:-8]) 442 _tarballs_specified.append(option[2:-8])
443 elif option.startswith('--version='):
444 _version = value
408445
409446
410# Adapt paths according to MG5 version specified447# Adapt paths according to MG5 version specified
411if _mg5_version:448if _mg5_version:
412 adapt_tarball_paths_according_to_MG5_version(_mg5_version)449 adapt_tarball_paths_according_to_MG5_version(_mg5_version)
413450
451# force code version if request by the user
452if _version:
453 if 'format_version' in _HepTools[target_tool]:
454 _version = _HepTools[target_tool]['format_version'](_version)
455 if '%(version)s' in _HepTools[target_tool]['tarball'][1]:
456 _HepTools[target_tool]['tarball'][1]=_HepTools[target_tool]['tarball'][1]%{'version':_version}
457 else:
458 raise Exception, 'fail to specify version for this tools.'
459
414# Apply substitutions if necessary:460# Apply substitutions if necessary:
415461
416for tool in _HepTools:462for tool in _HepTools:
@@ -420,8 +466,12 @@
420 if _HepTools[tool]['tarball'][0]=='local':466 if _HepTools[tool]['tarball'][0]=='local':
421 _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%\467 _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%\
422 {'prefix':_prefix, 'mg5_path': '' if _mg5_path is None else _mg5_path }468 {'prefix':_prefix, 'mg5_path': '' if _mg5_path is None else _mg5_path }
469
423 if _HepTools[tool]['tarball'][0]=='online':470 if _HepTools[tool]['tarball'][0]=='online':
424 _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%{'version':_HepTools[tool]['version']}471 version = _HepTools[tool]['version']
472 if 'format_version' in _HepTools[tool]:
473 version = _HepTools[tool]['format_version'](version)
474 _HepTools[tool]['tarball'][1]=_HepTools[tool]['tarball'][1]%{'version':version}
425 475
426 new_libs = []476 new_libs = []
427 for lib in _HepTools[tool]['libraries']:477 for lib in _HepTools[tool]['libraries']:
@@ -651,6 +701,54 @@
651 stderr=lhapdf5_log)701 stderr=lhapdf5_log)
652 lhapdf5_log.close()702 lhapdf5_log.close()
653703
704def install_gsl(tmp_path):
705 """Installation operations for lhapdf5"""
706 gsl_log = open(pjoin(_HepTools['gsl']['install_path'],"gsl_install.log"), "w")
707 subprocess.call([pjoin(_installers_path,'installgsl.sh'),
708 _HepTools['gsl']['install_path'],
709 _HepTools['gsl']['version'],
710 _HepTools['gsl']['tarball'][1]],
711 stdout=gsl_log,
712 stderr=gsl_log)
713 gsl_log.close()
714
715def install_fitsio(tmp_path):
716 """Installation operations for lhapdf5"""
717 log = open(pjoin(_HepTools['fitsio']['install_path'],"fitsio_install.log"), "w")
718 subprocess.call([pjoin(_installers_path,'installfitsio.sh'),
719 _HepTools['fitsio']['install_path'],
720 _HepTools['fitsio']['version'],
721 _HepTools['fitsio']['tarball'][1]],
722 stdout=log,
723 stderr=log)
724 log.close()
725
726def install_dragon(tmp_path):
727 """Installation operations for lhapdf5"""
728 log = open(pjoin(_HepTools['dragon']['install_path'],"dragon_install.log"), "w")
729 subprocess.call([pjoin(_installers_path,'installdragon.sh'),
730 _HepTools['dragon']['install_path'],
731 _HepTools['dragon']['version'],
732 _HepTools['dragon']['tarball'][1],
733 _HepTools['gsl']['install_path'],
734 _HepTools['fitsio']['install_path']],
735 stdout=log,
736 stderr=log)
737 log.close()
738
739def install_dragon_data(tmp_path):
740 """Installation operations for lhapdf5"""
741 log = open(pjoin(_HepTools['dragon_data']['install_path'],"dragon_data_install.log"), "w")
742 subprocess.call([pjoin(_installers_path,'installdragondata.sh'),
743 _HepTools['dragon_data']['install_path'],
744 _HepTools['dragon_data']['tarball'][1]
745 ],
746 stdout=log,
747 stderr=log)
748 log.close()
749
750
751
654def install_mg5amc_py8_interface(tmp_path):752def install_mg5amc_py8_interface(tmp_path):
655 """ Installation operations for the mg5amc_py8_interface"""753 """ Installation operations for the mg5amc_py8_interface"""
656 754
@@ -1101,6 +1199,8 @@
1101 return False1199 return False
1102 else:1200 else:
1103 return True1201 return True
1202 if target == 'dragon_data':
1203 return os.path.exists(pjoin(_HepTools[target]['install_path'],'data'))
1104 1204
1105 for f in _HepTools[target]['libraries']:1205 for f in _HepTools[target]['libraries']:
1106 if any(f.endswith(extension) for extension in _lib_extensions):1206 if any(f.endswith(extension) for extension in _lib_extensions):
11071207
=== added file 'installdragon.sh'
--- installdragon.sh 1970-01-01 00:00:00 +0000
+++ installdragon.sh 2018-04-13 18:55:59 +0000
@@ -0,0 +1,61 @@
1#!/bin/bash
2
3set_environment () {
4
5 echo " Set environment variables"
6
7 # Here, define your installation paths, versions etc.
8 gccversion="$(gcc -dumpversion)"
9 INSTALLD="$1"
10 VERSION="$2"
11 TARBALL="$3"
12 GSL="$4"
13 FITSIO="$5"
14 LOCAL=$INSTALLD
15
16 # set SLC5 platform name:
17 LCG_PLATFORM=i686
18 if [[ "$(uname -m)" == "x86_64" ]] ; then
19 LCG_PLATFORM=x86_64
20 fi
21}
22
23run () {
24
25
26
27 workd=$(pwd)
28
29 echo " Unpack Dragon"
30 unzip $TARBALL
31
32 echo " Enter Dragon directory"
33 cd Dragon-master
34
35 echo " Configure DRAGON"
36 echo " with GSL $GSL"
37 echo " with FITSIO $FITSIO"
38 ./start.sh
39if [ $(UNAME) = "Darwin" ]
40then
41 LD_LIBRARY_PATH=$GSL/lib:$FITSIO/lib:$LD_LIBRARY_PATH \
42 ./configure --prefix=$LOCAL --with-cfitsio=$FITSIO --with-gsl-path=$GSL/bin \
43 CC="gcc -arch x86_64" CXX="c++ -arch x86_64"
44else
45 LD_LIBRARY_PATH=$GSL/lib:$FITSIO/lib:$LD_LIBRARY_PATH \
46 ./configure --prefix=$LOCAL --with-cfitsio=$FITSIO --with-gsl-path=$GSL/bin
47fi
48 echo " Compile DRAGON"
49 make
50 make install
51
52 mkdir $LOCAL/output
53
54 echo " Finished DRAGON installation"
55 cd $workd
56
57}
58
59set_environment "$@"
60run "$@"
61
062
=== added file 'installdragondata.sh'
--- installdragondata.sh 1970-01-01 00:00:00 +0000
+++ installdragondata.sh 2018-04-13 18:55:59 +0000
@@ -0,0 +1,32 @@
1#!/bin/bash
2
3set_environment () {
4
5 echo " Set environment variables"
6
7 # Here, define your installation paths, versions etc.
8 gccversion="$(gcc -dumpversion)"
9 INSTALLD="$1"
10 TARBALL="$2"
11 LOCAL=$INSTALLD
12
13 # set SLC5 platform name:
14 LCG_PLATFORM=i686
15 if [[ "$(uname -m)" == "x86_64" ]] ; then
16 LCG_PLATFORM=x86_64
17 fi
18}
19
20run () {
21
22 workd=$(pwd)
23
24 echo " Unpack Dragon"
25 unzip $TARBALL
26 mv data $LOCAL/data
27
28}
29
30set_environment "$@"
31run "$@"
32
033
=== added file 'installfitsio.sh'
--- installfitsio.sh 1970-01-01 00:00:00 +0000
+++ installfitsio.sh 2018-04-13 18:55:59 +0000
@@ -0,0 +1,64 @@
1#!/bin/bash
2
3set_environment () {
4
5 echo " Set environment variables"
6
7 # Here, define your installation paths, versions etc.
8 gccversion="$(gcc -dumpversion)"
9 INSTALLD="$1"
10 VERSION="$2"
11 TARBALL="$3"
12 LOCAL=$INSTALLD
13
14 # set SLC5 platform name:
15 LCG_PLATFORM=i686
16 if [[ "$(uname -m)" == "x86_64" ]] ; then
17 LCG_PLATFORM=x86_64
18 fi
19}
20
21run () {
22#if [ $(UNAME) = "Darwin" ]
23#then
24# if [ -n `which brew`]
25# then
26# brew install cfitsio
27# fi
28# if [ -n `which port`]
29# then
30# port install cfitsio
31# fi
32#fi
33 workd=$(pwd)
34
35 echo " Unpack fitsio"
36 tar xvzf $TARBALL
37
38 echo " Enter fitsio directory"
39 cd cfitsio/
40
41 echo " Configure fitsio"
42 ./configure --prefix=$LOCAL
43
44 echo " Compile fitsio"
45 make
46
47 echo " Install fitsio"
48 make install
49
50 echo " Compile fitsio shared"
51 make shared
52
53 echo " Install fitsio"
54 make install
55
56
57 echo " Finished fitsio installation"
58 cd $workd
59
60}
61
62set_environment "$@"
63run "$@"
64
065
=== added file 'installgsl.sh'
--- installgsl.sh 1970-01-01 00:00:00 +0000
+++ installgsl.sh 2018-04-13 18:55:59 +0000
@@ -0,0 +1,49 @@
1#!/bin/bash
2
3set_environment () {
4
5 echo " Set environment variables"
6
7 # Here, define your installation paths, versions etc.
8 gccversion="$(gcc -dumpversion)"
9 INSTALLD="$1"
10 VERSION="$2"
11 TARBALL="$3"
12 LOCAL=$INSTALLD
13
14 # set SLC5 platform name:
15 LCG_PLATFORM=i686
16 if [[ "$(uname -m)" == "x86_64" ]] ; then
17 LCG_PLATFORM=x86_64
18 fi
19}
20
21run () {
22
23 workd=$(pwd)
24
25 echo " Unpack GSL"
26 tar xvzf $TARBALL
27
28 echo " Enter GSL directory"
29 cd gsl-${VERSION}/
30
31 echo " Configure GSL"
32 ./configure --prefix=$LOCAL
33
34 echo " Compile GSL"
35 make
36 make check
37 LIBRARY_PATH=$LD_LIBRARY_PATH make
38
39 echo " Install GSL"
40 make install
41
42 echo " Finished GSL installation"
43 cd $workd
44
45}
46
47set_environment "$@"
48run "$@"
49

Subscribers

People subscribed via source and target branches

to all changes: