Skip to content
Snippets Groups Projects
Commit 9faa06db authored by Ben Couturier's avatar Ben Couturier
Browse files

Initial version

parent 1e03c457
No related branches found
No related tags found
1 merge request!101Add Ninja to the path after LbLogin
......@@ -8,6 +8,7 @@ distribution_url = "http://cern.ch/lhcbproject/dist"
Python_version = "2.5"
CMT_version = "v1r20p20090520"
CMake_version = "3.3.2"
ninja_version = "1.4.0"
tbroadcast_version = "v2.0.5"
doxygen_version = "1.8.9.1"
......
......@@ -50,7 +50,7 @@ from SetupProject import SetupProject
from LbConfiguration.Platform import getBinaryDbg, getBinaryOpt
from LbConfiguration.Platform import getCompiler, getPlatformType, getArchitecture
from LbConfiguration.Platform import isBinaryDbg, NativeMachine
from LbConfiguration.External import CMT_version, CMake_version
from LbConfiguration.External import CMT_version, CMake_version, ninja_version
from LbConfiguration.Version import sortStrings, ParseSvnVersion
from LbUtils.Script import SourceScript
from LbUtils.Path import multiPathGet, multiPathGetFirst, multiPathJoin
......@@ -92,6 +92,11 @@ def _setCMakeVersionCb(_option, _opt_str, value, parser):
parser.values.use_cache = False
parser.values.cmakevers = value
def _setNinjaVersionCb(_option, _opt_str, value, parser):
if parser.values.ninjavers != value :
parser.values.use_cache = False
parser.values.ninjavers = value
def _noPythonCb(_option, _opt_str, _value, parser):
parser.values.get_python = False
parser.values.use_cache = False
......@@ -180,6 +185,13 @@ class LbLoginScript(SourceScript):
callback=_setCMakeVersionCb,
type="string",
help="set CMake version")
parser.set_defaults(ninjavers=ninja_version)
parser.add_option("--ninjavers",
action="callback",
callback=_setNinjaVersionCb,
type="string",
help="set Ninja version")
parser.set_defaults(scriptsvers=None)
parser.add_option("--scripts-version",
dest="scriptsvers",
......@@ -251,6 +263,11 @@ class LbLoginScript(SourceScript):
dest="use_cmtextratags",
action="store_true",
help="use CMTEXTRATAGS during the LbScripts setup")
parser.add_option("--lb-run",
dest="use_lb_run",
action="store_true",
default = False,
help="Use lb-run instead of SetupProject for condifguration [default: %default]")
#-----------------------------------------------------------------------------------
......@@ -565,6 +582,63 @@ class LbLoginScript(SourceScript):
except StopIteration:
log.debug('Cannot find CMake %s directory', opts.cmakevers)
def setNinja(self):
from os.path import join, pathsep, isdir
log = self.log
opts = self.options
log.debug("Looking for Ninja %s", opts.ninjavers)
if sys.platform.startswith('linux'):
subdir = "ninja/%s/x86_64-slc6" % opts.ninjavers
else:
log.debug('Ninja is not provided for platform %s', sys.platform)
return
ev = self.Environment()
def searchpath():
'''
Generator for all the possible locations of Ninja.
'''
if opts.mysiteroot:
for r in opts.mysiteroot.split(pathsep):
yield join(r, "contrib", subdir)
if 'CONTRIBDIR' in ev:
for r in ev['CONTRIBDIR'].split(pathsep):
yield join(r, subdir)
if 'SITEROOT' in ev:
for r in ev['SITEROOT'].split(pathsep):
yield join(r, 'sw', 'lcg', 'contrib', subdir)
yield join(r, 'sw', 'contrib', subdir)
yield join(r, 'contrib', subdir)
if opts.log_level == 'DEBUG':
# wrap the generator to print all the searched directories
_searchpath = searchpath
def searchpath():
for d in _searchpath():
log.debug("... trying %s", d)
yield d
try:
# look for the ninja directory
ninjaDir = (d for d in searchpath() if isdir(d)).next()
log.debug('Found %s', ninjaDir)
# if found, we remove all previous entries from the PATH...
substring = os.sep + 'ninja' + os.sep
path = [p for p in ev['PATH'].split(os.pathsep)
if substring not in p]
# ... prepend the new one...
path.insert(0, ninjaDir)
# ... and set the environment variable
ev['PATH'] = os.pathsep.join(path)
except StopIteration:
log.debug('Cannot find Ninja %s directory', opts.cmakevers)
#-----------------------------------------------------------------------------------
def setSoftLocations(self):
ev = self.Environment()
......@@ -1022,6 +1096,7 @@ class LbLoginScript(SourceScript):
self.setSite()
self.setCMT()
self.setCMake()
self.setNinja()
self.setSoftLocations()
self.setSharedArea()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment