forked from iLCSoft/iLCInstall
-
Notifications
You must be signed in to change notification settings - Fork 6
/
ilcsoft-install
executable file
·76 lines (57 loc) · 2.52 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
#!/usr/bin/env python
import os, sys
import logging
import commands
from ilcsoft import *
_version = "v02-03-00"
_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('--log-cfg-file', help='file to configure logging settings')
(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])
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
config_file_basename = config_file[config_file.rfind( '/' )+1:config_file.rfind(".")]
config_file_extension = config_file[config_file.rfind(".")+1:]
print '+ Running ilcsoft-install [ %s ]' % _version
print '+ Read configuration file [ %s ]' % config_file
execfile( config_file )
# 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
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 "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"