-
Notifications
You must be signed in to change notification settings - Fork 26
/
ilcsoft-install
executable file
·138 lines (106 loc) · 5.23 KB
/
ilcsoft-install
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
#!/usr/bin/env python
from __future__ import print_function
import os, sys
import logging
from ilcsoft import *
from util import getoutput
_version = "v01-17-07"
_usage = """%prog [options] INSTALL_CONFIG_FILE
if called with no options only an installation summary is shown
"""
# ---------- CONFIGURE COMMAND LINE OPTIONS ------------------------------
from optparse import OptionParser
parser = OptionParser( usage=_usage, version=_version )
parser.add_option('-p', '--preview', action='store_true', help='preview installation')
parser.add_option('-d', '--dependencies', action='store_true', help='show dependencies')
parser.add_option('-i', '--install', action='store_true', help='install the software')
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='run in DEBUG mode')
parser.add_option('-j', '--ncores', action='store', dest='ncores', default=4, help='number of cores to use')
parser.add_option('--log-cfg-file', help='file to configure logging settings')
parser.add_option('--install-prefix', action='store', help='location where to install the software')
(options, args) = parser.parse_args()
if len(args) != 1:
parser.error('incorrect number of arguments (-h for help)')
# ------------------------------------------------------------------------
if options.log_cfg_file:
logging.config.fileConfig( options.log_cfg_file )
if options.verbose:
root_logger=logging.getLogger()
root_logger.setLevel(logging.DEBUG)
# define handler for writting messages to console
ch = logging.StreamHandler(sys.stdout)
# bind the console handler to the logger
root_logger.addHandler(ch)
# set the logging level
ch.setLevel( logging.DEBUG )
config_file = os.path.abspath(args[0])
ncores = 4
if options.ncores:
ncores = options.ncores
if( not os.path.exists(config_file) ):
parser.error( 'config file %s does not exist' % config_file )
# some settings needed for reading nightly build cfg files
date_iso8601 = getoutput( "date +%F" )
config_file_basename = config_file[config_file.rfind( '/' )+1:config_file.rfind(".")]
config_file_extension = config_file[config_file.rfind(".")+1:]
# desy afs directories
ilcsoft_afs_path={}
ilcsoft_afs_path['base'] = '/afs/desy.de/project/ilcsoft/sw'
ilcsoft_afs_path['gcc34_32bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'i386_gcc34_sl4' ))
ilcsoft_afs_path['gcc41_32bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'i386_gcc41_sl5' ))
ilcsoft_afs_path['gcc41_64bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc41_sl5' ))
ilcsoft_afs_path['gcc44_64bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc44_sl6' ))
ilcsoft_afs_path['gcc48_64bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc48_sl6' ))
ilcsoft_afs_path['gcc49_64bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc49_sl6' ))
ilcsoft_afs_path['gcc82_64bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc82_sl6' ))
ilcsoft_afs_path['gcc82_64bit_centos7'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc82_centos7' ))
ilcsoft_afs_path['gcc46_64bit'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc46_ub1204' ))
ilcsoft_afs_path['gcc75_64bit_ub1804'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc75_ub1804' ))
ilcsoft_afs_path['gcc93_64bit_ub2004'] = os.path.normpath( os.path.join( ilcsoft_afs_path['base'] , 'x86_64_gcc93_ub2004' ))
ilcsoft_afs_path['gcc10_64bit_centos7'] = os.path.normpath(os.path.join(ilcsoft_afs_path['base'], 'x86_64_gcc103_centos7'))
ilcPath = None
installPrefix = None
if options.install_prefix:
installPrefix = options.install_prefix
try:
import platform
sizeofint = platform.architecture()[0]
#gccver = ''.join( platform.python_compiler().split()[-1].split('.')[:2] )
gccver = ''.join(platform.python_compiler().split()[1].split('.')[:2])
arch = 'gcc' + gccver + '_' + sizeofint
platf = platform.platform()
if( platf.find("bionic")>0):
arch += "_ub1804"
if( platf.find("focal")>0):
arch += "_ub2004"
if( platf.find("centos-7")>0):
arch += "_centos7"
ilcPath = ilcsoft_afs_path[ arch ] + '/'
gcccheck = platform.python_compiler()
print(gcccheck)
print(ilcPath)
print(arch)
print(gccver)
except:
pass
nightlies = False
print('+ Running ilcsoft-install [ %s ]' % _version)
print('+ Read configuration file [ %s ]' % config_file)
exec(compile(open( config_file, "rb" ).read(), config_file, 'exec'))
# pass the name of the config file to ilcsoft.py
ilcsoft.config_file = config_file
ilcsoft.config_file_prefix = config_file_basename
ilcsoft.config_file_suffix = config_file_extension
# this is for initializing the modules
# (called right after reading the config file)
ilcsoft.init()
# display an installation summary
ilcsoft.summary()
if options.preview :
ilcsoft.previewinstall()
if options.install :
ilcsoft.makeinstall()
print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
if options.dependencies :
ilcsoft.showDependencies()
print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")