Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:snoplus/snoing
Browse files Browse the repository at this point in the history
  • Loading branch information
pgjones committed Mar 5, 2013
2 parents f1f0df7 + 9766073 commit 85ff0a5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
9 changes: 6 additions & 3 deletions core/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class System(object):
executed.
"""
Mac, Linux = range(2)
def __init__(self, logger, cache_path, install_path, install_mode=None, arguments=[]):
def __init__(self, logger, cache_path, install_path, install_mode=None, arguments={}):
""" Initialise with a logger for output and a prefered cache and install path. The
install_mode is optional, None is no install mode required. The arguments are extra
arguments applied to all configure script calls (package specific).
Expand Down Expand Up @@ -106,11 +106,14 @@ def get_os_type(self):
return self._os_type
####################################################################################################
# Functions that do stuff to the system
def configure_command(self, command='./configure', args=[], cwd=None, env={}, verbose=False):
def configure_command(self, command='./configure', args=[], cwd=None, env={}, verbose=False, config_type=None):
""" Execute a configure command, add the extra arguments."""
if cwd is None:
cwd = self.get_install_path()
args.extend(self._arguments)
if config_type in self._arguments:
args.extend(self._arguments[config_type])
else:
self._logger.error('config type %s does not exit!'%(config_type))
self.execute_command(command, args, cwd, env, verbose)
def execute_command(self, command, args=[], cwd=None, env={}, verbose=False):
""" Execute the command with args, extra environment env in the path cwd."""
Expand Down
2 changes: 1 addition & 1 deletion packages/curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def _install(self):
source_path = os.path.join(self._system.get_install_path(), "%s-source" % self._name)
self._system.untar_file(self._tar_name, source_path, 1)
self._system.configure_command(args=["--prefix=%s" % self.get_install_path()],
cwd=source_path)
cwd=source_path, config_type="curl")
self._system.execute_command("make", cwd=source_path)
self._system.execute_command("make", ["install"], cwd=source_path)
8 changes: 4 additions & 4 deletions packages/geant4.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _install(self):
cmake_command = "cmake"
if self._dependency_paths["cmake"] is not None: # Special cmake installed
cmake_command = "%s/bin/cmake" % self._dependency_paths["cmake"]
self._system.configure_command(cmake_command, cmake_opts, self.get_install_path(), env)
self._system.configure_command(cmake_command, cmake_opts, self.get_install_path(), env, config_type="geant4")
self._system.execute_command("make", [], self.get_install_path(), env)
self._system.execute_command("make", ['install'], self.get_install_path(), env)
def _patch_timeout(self):
Expand Down Expand Up @@ -128,12 +128,12 @@ def _install(self):
self.write_geant4_config_file()
self._system.configure_command('./Configure', ['-incflags', '-build', '-d', '-e',
'-f', "geant4-snoing-config.sh"],
cwd=self.get_install_path())
cwd=self.get_install_path(), config_type="geant4")
self._system.configure_command('./Configure', ['-incflags', '-install', '-d', '-e',
'-f', "geant4-snoing-config.sh"],
cwd=self.get_install_path())
cwd=self.get_install_path(), config_type="geant4")
try:
self._system.configure_command('./Configure', cwd=self.get_install_path())
self._system.configure_command('./Configure', cwd=self.get_install_path(), config_type="geant4")
except Exception: # Geant4 configure always fails, it is annoying
pass
if not os.path.exists(os.path.join(self.get_install_path(),'env.sh')):
Expand Down
15 changes: 10 additions & 5 deletions snoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def print_error_message():
parser.add_option("-v", action="store_true", dest="verbose", help="Verbose Install?",
default=False)
parser.add_option("-a", action="store_true", dest="all", help="All packages?")
parser.add_option("-A", type="string", dest="arguments", help=optparse.SUPPRESS_HELP)
parser.add_option("--Ac", type="string", dest="curl_arguments", help=optparse.SUPPRESS_HELP)
parser.add_option("--Ar", type="string", dest="root_arguments", help=optparse.SUPPRESS_HELP)
parser.add_option("--Ag", type="string", dest="geant4_arguments", help=optparse.SUPPRESS_HELP)

installerGroup = optparse.OptionGroup(parser, "Optional Install modes",
("Default snoing action is to install non graphically, i.e."
Expand Down Expand Up @@ -95,10 +97,13 @@ def print_error_message():
else:
install_mode = installmode.Normal
# Sort out the extra arguments
if options.arguments is not None:
opt_args = options.arguments.split()
else:
opt_args = []
opt_args = {"root":[],"geant4":[],"curl":[]}
if options.root_arguments is not None:
opt_args["root"] = options.root_arguments.split()
if options.geant4_arguments is not None:
opt_args["geant4"] = options.geant4_arguments.split()
if options.curl_arguments is not None:
opt_args["curl"] = options.curl_arguments.split()
try:
install_system = system.System(logger, options.cache_path, options.install_path, install_mode, opt_args)
except snoing_exceptions.InstallModeException, e:
Expand Down

0 comments on commit 85ff0a5

Please sign in to comment.