diff --git a/src/SBMS/sbms.py b/src/SBMS/sbms.py index 4c3c43c3e..e66d33868 100644 --- a/src/SBMS/sbms.py +++ b/src/SBMS/sbms.py @@ -1,4 +1,14 @@ - +from __future__ import print_function +from __future__ import absolute_import +from __future__ import division +from __future__ import unicode_literals + +from builtins import open +from builtins import filter +from builtins import int +from builtins import str +from future import standard_library +standard_library.install_aliases() import os import subprocess import SCons @@ -34,14 +44,14 @@ def library(env, libname=''): # Add C/C++, and FORTRAN targets env.AppendUnique(ALL_SOURCES = env.Glob('*.c')) #env.AppendUnique(ALL_SOURCES = env.Glob('*.cc')) - env.AppendUnique(ALL_SOURCES = filter(IsNotSWIGWrapper,env.Glob('*.cc'))) + env.AppendUnique(ALL_SOURCES = list(filter(IsNotSWIGWrapper,env.Glob('*.cc')))) env.AppendUnique(ALL_SOURCES = env.Glob('*.cpp')) env.AppendUnique(ALL_SOURCES = env.Glob('*.F')) env.AppendUnique(ALL_SOURCES = env.Glob('*.f90')) sources = env['ALL_SOURCES'] objects = env['MISC_OBJECTS'] - if 'IGNORE_SOURCES' in env.Dictionary().keys(): + if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): ignore = env['IGNORE_SOURCES'] sources = [s for s in env['ALL_SOURCES'] if s.name not in ignore] @@ -50,7 +60,7 @@ def library(env, libname=''): myobjs.extend(objects) mylib = env.Library(target = libname, source = myobjs) - AddRECONPaths(env) + AddRECONPaths(env) # Cleaning and installation are restricted to the directory # scons was launched from or its descendents @@ -92,7 +102,7 @@ def executable(env, exename=''): ReorderCommonLibraries(env) sources = env['ALL_SOURCES'] - if 'IGNORE_SOURCES' in env.Dictionary().keys(): + if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): ignore = env['IGNORE_SOURCES'] sources = [s for s in env['ALL_SOURCES'] if s.name not in ignore] @@ -100,7 +110,7 @@ def executable(env, exename=''): myobjs = env.Object(sources) myexe = env.Program(target = exename, source = myobjs) - AddRECONPaths(env) + AddRECONPaths(env) # Cleaning and installation are restricted to the directory # scons was launched from or its descendents @@ -217,7 +227,7 @@ def executables(env): common_sources.extend(env['ALL_SOURCES']) - if 'IGNORE_SOURCES' in env.Dictionary().keys(): + if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): ignore = env['IGNORE_SOURCES'] main_sources = [s for s in main_sources if s.name not in ignore] common_sources = [s for s in common_sources if s.name not in ignore] @@ -263,12 +273,12 @@ def plugin(env, pluginname=''): #print str([x.rstr() for x in env.Glob('*.cc')]) sources = env['ALL_SOURCES'] - if 'IGNORE_SOURCES' in env.Dictionary().keys(): + if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): ignore = env['IGNORE_SOURCES'] sources = [s for s in env['ALL_SOURCES'] if s.name not in ignore] # Strip out libs that don't need to be linked in plugin - if 'OPTIONAL_PLUGIN_LIBS' in env.Dictionary().keys() : + if 'OPTIONAL_PLUGIN_LIBS' in list(env.Dictionary().keys()) : REDUCED_LIBS = [s for s in env['LIBS'] if s not in env['OPTIONAL_PLUGIN_LIBS'] ] env.Replace(LIBS=REDUCED_LIBS) @@ -456,21 +466,22 @@ def ApplyPlatformSpecificSettings(env, platform): # "."s. The Python module loader doesn't like these and we have to # replace them with "-"s to appease it. + platform = str(platform) platform = re.sub('\.', '-', platform) modname = "sbms_%s" % platform if (int(env['SHOWBUILD']) > 0): - print "looking for %s.py" % modname + print("looking for %s.py" % modname) try: InitENV = getattr(__import__(modname), "InitENV") # Run the InitENV function (if found) if(InitENV != None): - print "sbms : Applying settings for platform %s" % platform + print("sbms : Applying settings for platform %s" % platform) InitENV(env) - except ImportError,e: - if (int(env['SHOWBUILD']) > 0): print "%s" % e + except ImportError as e: + if (int(env['SHOWBUILD']) > 0): print("%s" % e) pass @@ -553,8 +564,8 @@ def AddJANA(env): # Only run jana-config the first time through if "JANA_CFLAGS" not in AddJANA.__dict__: - AddJANA.JANA_CFLAGS = subprocess.Popen(["%s/bin/jana-config" % jana_home,"--jana-only","--cflags"], stdout=subprocess.PIPE).communicate()[0] - AddJANA.JANA_LINKFLAGS = subprocess.Popen(["%s/bin/jana-config" % jana_home,"--jana-only","--libs"], stdout=subprocess.PIPE).communicate()[0] + AddJANA.JANA_CFLAGS = str(subprocess.Popen(["%s/bin/jana-config" % jana_home,"--jana-only","--cflags"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') + AddJANA.JANA_LINKFLAGS = str(subprocess.Popen(["%s/bin/jana-config" % jana_home,"--jana-only","--libs"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') AddCompileFlags(env, AddJANA.JANA_CFLAGS) AddLinkFlags(env, AddJANA.JANA_LINKFLAGS) @@ -584,8 +595,8 @@ def AddMySQL(env): # Only run mysql_config the first time through if "MYSQL_CFLAGS" not in AddMySQL.__dict__: - AddMySQL.MYSQL_CFLAGS = subprocess.Popen(["mysql_config","--cflags"], stdout=subprocess.PIPE).communicate()[0] - AddMySQL.MYSQL_LINKFLAGS = subprocess.Popen(["mysql_config","--libs"], stdout=subprocess.PIPE).communicate()[0] + AddMySQL.MYSQL_CFLAGS = str(subprocess.Popen(["mysql_config","--cflags"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') + AddMySQL.MYSQL_LINKFLAGS = str(subprocess.Popen(["mysql_config","--libs"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') AddCompileFlags(env, AddMySQL.MYSQL_CFLAGS) AddLinkFlags(env, AddMySQL.MYSQL_LINKFLAGS) @@ -600,14 +611,14 @@ def AddRECONPaths(env): env.AppendUnique(LIBPATH = ["%s/%s/lib" % (halld_recon_home, env['OSNAME'])]) # skip smearing DIRC if hit object doesn't exist in halld_recon (ie. it's an old version) - if os.path.exists(halld_recon_home+"/src/libraries/DIRC/DDIRCPmtHit.h"): + if os.path.exists(halld_recon_home+"/src/libraries/DIRC/DDIRCPmtHit.h"): AddCompileFlags(env, "-DSMEARDIRC") ################################## # DANA ################################## def AddDANA(env): - AddRECONPaths(env) + AddRECONPaths(env) AddHDDM(env) AddROOT(env) AddJANA(env) @@ -624,7 +635,7 @@ def AddDANA(env): DANA_LIBS += " DAQ JANA EVENTSTORE TRD" DANA_LIBS += " expat" env.PrependUnique(LIBS = DANA_LIBS.split()) - env.Append(LIBS = 'DANA') + env.Append(LIBS = 'DANA') env.PrependUnique(OPTIONAL_PLUGIN_LIBS = DANA_LIBS.split()) ################################## @@ -632,8 +643,9 @@ def AddDANA(env): ################################## def Add_xstream(env): env.AppendUnique(CPPPATH = ['#external/xstream/include']) + env.AppendUnique(CPPPATH = ['/usr/include/tirpc']) env.AppendUnique(CCFLAGS = ['-fPIC']) - env.AppendUnique(LIBS=['xstream', 'bz2', 'z']) + env.AppendUnique(LIBS=['xstream', 'tirpc', 'bz2', 'z']) env.AppendUnique(OPTIONAL_PLUGIN_LIBS = ['xstream', 'bz2', 'z']) @@ -787,6 +799,9 @@ def AddXERCES(env): def AddCERNLIB(env): env.PrependUnique(FORTRANFLAGS = ['-ffixed-line-length-0', '-fno-second-underscore']) env.PrependUnique(FORTRANFLAGS = ['-fno-automatic']) + gccver = gcc_major_version() + if gccver >= 10: + env.PrependUnique(FORTRANFLAGS = ['-fallow-argument-mismatch']) #env.PrependUnique(FORTRANPATH = ['include']) cern = os.getenv('CERN', '/usr/local/cern/PRO') cern_level = os.getenv('CERN_LEVEL', '2006') @@ -818,14 +833,14 @@ def AddROOT(env): rootsys = os.getenv('ROOTSYS', '/usr/local/root/PRO') if not os.path.isdir(rootsys): - print 'ROOTSYS not defined or points to a non-existant directory!' + print('ROOTSYS not defined or points to a non-existant directory!') sys.exit(-1) # Only root-config the first time through if "ROOT_CFLAGS" not in AddROOT.__dict__: - AddROOT.ROOT_CFLAGS = subprocess.Popen(["%s/bin/root-config" % rootsys, "--cflags"], stdout=subprocess.PIPE).communicate()[0] - AddROOT.ROOT_LINKFLAGS = subprocess.Popen(["%s/bin/root-config" % rootsys, "--glibs" ], stdout=subprocess.PIPE).communicate()[0] - has_tmva = subprocess.Popen(["%s/bin/root-config" % rootsys, "--has-tmva" ], stdout=subprocess.PIPE).communicate()[0] + AddROOT.ROOT_CFLAGS = str(subprocess.Popen(["%s/bin/root-config" % rootsys, "--cflags"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') + AddROOT.ROOT_LINKFLAGS = str(subprocess.Popen(["%s/bin/root-config" % rootsys, "--glibs" ], stdout=subprocess.PIPE).communicate()[0], 'utf-8') + has_tmva = str(subprocess.Popen(["%s/bin/root-config" % rootsys, "--has-tmva" ], stdout=subprocess.PIPE).communicate()[0], 'utf-8') if 'yes' in has_tmva: AddROOT.ROOT_CFLAGS += ' -DHAVE_TMVA=1' AddROOT.ROOT_LINKFLAGS += ' -lTMVA' @@ -866,7 +881,7 @@ def AddROOT(env): elif os.path.exists(rootcintpath): bld = SCons.Script.Builder(action = rootcintaction, suffix='_Dict.cc', src_suffix='.h') else: - print 'Neither rootcint nor rootcling exists. Unable to create ROOT dictionaries if any encountered.' + print('Neither rootcint nor rootcling exists. Unable to create ROOT dictionaries if any encountered.') return env.Append(BUILDERS = {'ROOTDict' : bld}) @@ -883,13 +898,13 @@ def AddROOT(env): curpath = os.getcwd() srcpath = env.Dir('.').srcnode().abspath if(int(env['SHOWBUILD'])>1): - print "---- Scanning for headers to generate ROOT dictionaries in: %s" % srcpath + print("---- Scanning for headers to generate ROOT dictionaries in: %s" % srcpath) os.chdir(srcpath) for f in glob.glob('*.[h|hh|hpp]'): if 'ClassDef' in open(f).read(): env.AppendUnique(ALL_SOURCES = env.ROOTDict(f)) if(int(env['SHOWBUILD'])>1): - print " ROOT dictionary for %s" % f + print(" ROOT dictionary for %s" % f) os.chdir(curpath) @@ -970,11 +985,11 @@ def AddROOTSpyMacros(env): curpath = os.getcwd() srcpath = env.Dir('.').srcnode().abspath if(int(env['SHOWBUILD'])>1): - print "---- Looking for ROOT macro files (*.C) in: %s" % srcpath + print("---- Looking for ROOT macro files (*.C) in: %s" % srcpath) os.chdir(srcpath) for f in glob.glob('*.C'): env.AppendUnique(ALL_SOURCES = env.ROOTSpyMacro(f)) - if(int(env['SHOWBUILD'])>1) : print " ROOTSpy Macro for %s" % f + if(int(env['SHOWBUILD'])>1) : print(" ROOTSpy Macro for %s" % f) os.chdir(curpath) @@ -989,8 +1004,8 @@ def AddSWIG(env): if ProgramExists("swig"): env.AppendUnique(SWIG_EXISTS = "1") if not env['BUILDSWIG'] or int(env['BUILDSWIG']) != 1: - print '-- NOTE: swig exists but will not be used unless you --' - print '-- add "BUILDSWIG=1" to the scons command line. --' + print('-- NOTE: swig exists but will not be used unless you --') + print('-- add "BUILDSWIG=1" to the scons command line. --') else: env.AppendUnique(SWIG_EXISTS = "0") # TEMPORARILY DISABLE @@ -1033,7 +1048,7 @@ def AddCUDA(env): srcpath = env.Dir('.').srcnode().abspath os.chdir(srcpath) for f in glob.glob('*.cu'): - if env['SHOWBUILD']>0 : print 'Adding %s' % f + if env['SHOWBUILD']>0 : print('Adding %s' % f) env.AppendUnique(MISC_OBJECTS = env.CUDA(f)) os.chdir(curpath) @@ -1052,10 +1067,10 @@ def AddAmpTools(env): # printed and env left unchanged. AMPTOOLS = os.getenv('AMPTOOLS') if AMPTOOLS==None: - print '' - print 'AmpTools is being requested but the AMPTOOLS environment variable' - print 'is not set. Expect to see an error message below....' - print '' + print('') + print('AmpTools is being requested but the AMPTOOLS environment variable') + print('is not set. Expect to see an error message below....') + print('') else: env.AppendUnique(CUDAFLAGS=['-I%s -I%s/src/libraries' % (AMPTOOLS, os.getenv('HALLD_SIM_HOME',os.getcwd()))]) AddCUDA(env) @@ -1064,9 +1079,9 @@ def AddAmpTools(env): AMPTOOLS_LIBS = 'AmpTools' if os.getenv('CUDA')!=None and os.path.exists('%s/lib/libAmpTools_GPU.a' % AMPTOOLS): AMPTOOLS_LIBS = 'AmpTools_GPU' - print 'Using GPU enabled AMPTOOLS library' + print('Using GPU enabled AMPTOOLS library') - env.AppendUnique(CXXFLAGS = ['-DHAVE_AMPTOOLS_MCGEN']) + env.AppendUnique(CXXFLAGS = ['-DHAVE_AMPTOOLS_MCGEN']) env.AppendUnique(CPPPATH = AMPTOOLS_CPPPATH) env.AppendUnique(LIBPATH = AMPTOOLS_LIBPATH) env.AppendUnique(LIBS = AMPTOOLS_LIBS) @@ -1091,10 +1106,10 @@ def AddAmpPlotter(env): def AddHepMC(env): HEPMC_HOME = os.getenv('HEPMCDIR') if HEPMC_HOME==None: - print '' - print 'HepMC is being requested but the HEPMCDIR environment variable is not set!' - print '' - else: + print('') + print('HepMC is being requested but the HEPMCDIR environment variable is not set!') + print('') + else: HEPMC_CPPPATH = "%s/include" % (HEPMC_HOME) HEPMC_LIBPATH = "%s/lib" % (HEPMC_HOME) HEPMC_LIBS = "HepMC" @@ -1109,10 +1124,10 @@ def AddHepMC(env): def AddPhotos(env): PHOTOS_HOME = os.getenv('PHOTOSDIR') if PHOTOS_HOME==None: - print '' - print 'Photos is being requested but the PHOTOSDIR environment variable is not set!' - print '' - else: + print('') + print('Photos is being requested but the PHOTOSDIR environment variable is not set!') + print('') + else: PHOTOS_CPPPATH = "%s/include" % (PHOTOS_HOME) PHOTOS_LIBPATH = "%s/lib" % (PHOTOS_HOME) PHOTOS_LIBS = [ "Photospp", "PhotosppHepMC" ] @@ -1128,10 +1143,10 @@ def AddPhotos(env): def AddEvtGen(env): EVTGEN_HOME = os.getenv('EVTGENDIR') if EVTGEN_HOME==None: - print '' - print 'EvtGen is being requested but the EVTGENDIR environment variable is not set!' - print '' - else: + print('') + print('EvtGen is being requested but the EVTGENDIR environment variable is not set!') + print('') + else: AddHepMC(env) AddPhotos(env) EVTGEN_CPPPATH = "%s/" % (EVTGEN_HOME) @@ -1149,10 +1164,22 @@ def AddEvtGen(env): ################################## def AddUtilities(env): AddCCDB(env) - pyincludes = subprocess.Popen(["python-config", "--includes" ], stdout=subprocess.PIPE).communicate()[0] + pythonconfig = env['PYTHONCONFIG'] + pyincludes = str(subprocess.Popen([pythonconfig, "--includes" ], stdout=subprocess.PIPE).communicate()[0], 'utf-8') env.AppendUnique(CCFLAGS = pyincludes.rstrip().split()) # BOOST is required by cobrems and if it is not installed in /usr or /usr/local then we must get it from the environment boost_root = os.getenv('BOOST_ROOT') if boost_root != None: env.AppendUnique(CPPPATH = [boost_root + "/include"]) +################################## +# miscellanous +################################## +def gcc_major_version(): + outstr = str(subprocess.Popen(["gcc", "--version" ], stdout=subprocess.PIPE).communicate()[0], 'utf-8') + tokens = outstr.split() + version = tokens[2] + vtokens = version.split('.') + version_major_str = vtokens[0] + major_version = int(version_major_str) + return major_version diff --git a/src/SBMS/sbms3.py b/src/SBMS/sbms3.py deleted file mode 100644 index 7f285ff75..000000000 --- a/src/SBMS/sbms3.py +++ /dev/null @@ -1,1160 +0,0 @@ - -import os -import subprocess -import SCons -import glob -import re -import sys - -EXT_SUFFIX = 0 - -#=========================================================== -# The first 4 functions provide for building a library, -# program, multiple-programs, or plugin from all the source -# in the current directory. -# -# The next section contains useful utility functions. -# -# The functions that follow in the final section add support -# for various packages (e.g. ROOT, Xerces, ...) -#=========================================================== - - -################################## -# library -################################## -def library(env, libname=''): - - # Library name comes from directory name - if libname=='': - libname = os.path.split(os.getcwd())[1] - - env.PrependUnique(CPPPATH = ['.']) - - # Add C/C++, and FORTRAN targets - env.AppendUnique(ALL_SOURCES = env.Glob('*.c')) - #env.AppendUnique(ALL_SOURCES = env.Glob('*.cc')) - env.AppendUnique(ALL_SOURCES = list(filter(IsNotSWIGWrapper,env.Glob('*.cc')))) - env.AppendUnique(ALL_SOURCES = env.Glob('*.cpp')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.F')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.f90')) - - sources = env['ALL_SOURCES'] - objects = env['MISC_OBJECTS'] - if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): - ignore = env['IGNORE_SOURCES'] - sources = [s for s in env['ALL_SOURCES'] if s.name not in ignore] - - # Build static library from all source - myobjs = env.Object(sources) - myobjs.extend(objects) - mylib = env.Library(target = libname, source = myobjs) - - AddRECONPaths(env) - - # Cleaning and installation are restricted to the directory - # scons was launched from or its descendents - CurrentDir = env.Dir('.').srcnode().abspath - if not CurrentDir.startswith(env.GetLaunchDir()): - # Not in launch directory. Tell scons not to clean these targets - env.NoClean([myobjs, mylib]) - else: - # We're in launch directory (or descendent) schedule installation - - # Installation directories for library and headers - installdir = env.subst('$INSTALLDIR') - includedir = "%s/%s" %(env.subst('$INCDIR'), libname) - libdir = env.subst('$LIBDIR') - - # Install targets - env.Install(libdir, mylib) - env.Install(includedir, env.Glob('*.h')+env.Glob('*.hh')+env.Glob('*.hpp')) - - -################################## -# executable -################################## -def executable(env, exename=''): - - # Executable name comes from directory name - if exename=='': - exename = os.path.split(os.getcwd())[1] - - env.PrependUnique(CPPPATH = ['.']) - - # Add C/C++, and FORTRAN targets - env.AppendUnique(ALL_SOURCES = env.Glob('*.c')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.cc')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.cpp')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.F')) - - # Push commonly used libraries to end of list - ReorderCommonLibraries(env) - - sources = env['ALL_SOURCES'] - if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): - ignore = env['IGNORE_SOURCES'] - sources = [s for s in env['ALL_SOURCES'] if s.name not in ignore] - - # Build program from all source - myobjs = env.Object(sources) - myexe = env.Program(target = exename, source = myobjs) - - AddRECONPaths(env) - - # Cleaning and installation are restricted to the directory - # scons was launched from or its descendents - CurrentDir = env.Dir('.').srcnode().abspath - if not CurrentDir.startswith(env.GetLaunchDir()): - # Not in launch directory. Tell scons not to clean these targets - env.NoClean([myobjs, myexe]) - else: - # We're in launch directory (or descendent) schedule installation - - # Installation directories for executable and headers - installdir = env.subst('$INSTALLDIR') - includedir = env.subst('$INCDIR') - bindir = env.subst('$BINDIR') - - # Install targets - env.Install(bindir, myexe) - - -################################## -# python_so_module -################################## -def python_so_module(env, modname): - - # This will build a single python extension module - # from c/c++ sources as a shared library (.so) and - # install it either in $INSTALLDIR/python2 or else - # $INSTALLDIR/python3 depending on which version of - # python the user environment has installed. - - # Build the module as a shared library - # using the distutils setup.py mechanism. - if env['SHOWBUILD']==0: - setup_py_action = SCons.Script.Action('python $SOURCE build -b ' + - 'build_' + modname + - ' > /dev/null', - 'PYMODBUILD [$SOURCE]') - else: - setup_py_action = SCons.Script.Action('python $SOURCE build -b ' + - 'build_' + modname) - setup_py_builder = SCons.Script.Builder(action = setup_py_action) - env.Append(BUILDERS = {'PYMODBUILD' : setup_py_builder}) - - # Look up EXT_SUFFIX in the distutils config variables. - # Unfortunately scons erases the system-set python path, - # so I cannot import distutils directly here. - # Spawn another python shell for that. - global EXT_SUFFIX - if EXT_SUFFIX == 0: - req = subprocess.Popen(['python', '-c', - 'from distutils import sysconfig;' + - 'print(sysconfig.get_config_var("EXT_SUFFIX"))'], - stdout=subprocess.PIPE) - EXT_SUFFIX = req.communicate()[0].rstrip() - if EXT_SUFFIX == "None": - mymod = modname + '.so' - moduledir = env.subst('$PYTHON2DIR') - else: - mymod = modname + EXT_SUFFIX - moduledir = env.subst('$PYTHON3DIR') - modsource = 'setup_' + modname + '.py' - modlib = env.PYMODBUILD(mymod, modsource) - - # Add dependencies of the shared module on the setup.py and c++ sources - env.Depends([mymod], [modsource, "py" + modname + ".cpy"]) - - # Cleaning and installation are restricted to the directory - # scons was launched from or its descendents - CurrentDir = env.Dir('.').srcnode().abspath - if not CurrentDir.startswith(env.GetLaunchDir()): - # Not in launch directory. Tell scons not to clean these targets - env.NoClean([modlib]) - else: - # We're in launch directory (or descendent) schedule installation - - # Install targets - env.Install(moduledir, modlib) - - -################################## -# executables -################################## -def executables(env): - - # This will generate multiple executables from the - # source in the current directory. It does this - # by identifying source files that define "main()" - # and linking those with all source files that do not - # define "main()". Program names are based on the - # filename of the source file defining "main()" - main_sources = [] - common_sources = [] - curpath = os.getcwd() - srcpath = env.Dir('.').srcnode().abspath - os.chdir(srcpath) - files = glob.glob('*.c') + glob.glob('*.cc') + glob.glob('*.cpp') - for f in files: - if 'main(' in open(f).read(): - main_sources.append(f) - else: - common_sources.append(f) - - for f in glob.glob('*.F'): - if ' PROGRAM ' in open(f).read(): - main_sources.append(f) - else: - common_sources.append(f) - os.chdir(curpath) - - env.PrependUnique(CPPPATH = ['.']) - - # Push commonly used libraries to end of list - ReorderCommonLibraries(env) - - common_sources.extend(env['ALL_SOURCES']) - - if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): - ignore = env['IGNORE_SOURCES'] - main_sources = [s for s in main_sources if s.name not in ignore] - common_sources = [s for s in common_sources if s.name not in ignore] - - # Build program from all source - main_objs = env.Object(main_sources) - common_objs = env.Object(common_sources) - - progs = [] - for obj in main_objs: - exename = re.sub('\.o$', '', str(obj)) # strip off ".o" from object file name - progs.append(env.Program(target = exename, source = [obj, common_objs])) - - # Cleaning and installation are restricted to the directory - # scons was launched from or its descendents - CurrentDir = env.Dir('.').srcnode().abspath - if not CurrentDir.startswith(env.GetLaunchDir()): - # Not in launch directory. Tell scons not to clean these targets - env.NoClean([common_objs, main_objs, progs]) - else: - # We're in launch directory (or descendent) schedule installation - bindir = env.subst('$BINDIR') - env.Install(bindir, progs) - - -################################## -# plugin -################################## -def plugin(env, pluginname=''): - - # Library name comes from directory name - if pluginname=='': - pluginname = os.path.split(os.getcwd())[1] - - env.PrependUnique(CPPPATH = ['.']) - - # Add C/C++ targets - env.AppendUnique(ALL_SOURCES = env.Glob('*.c')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.cc')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.cpp')) - env.AppendUnique(ALL_SOURCES = env.Glob('*.F')) - - #print str([x.rstr() for x in env.Glob('*.cc')]) - - sources = env['ALL_SOURCES'] - if 'IGNORE_SOURCES' in list(env.Dictionary().keys()): - ignore = env['IGNORE_SOURCES'] - sources = [s for s in env['ALL_SOURCES'] if s.name not in ignore] - - # Strip out libs that don't need to be linked in plugin - if 'OPTIONAL_PLUGIN_LIBS' in list(env.Dictionary().keys()) : - REDUCED_LIBS = [s for s in env['LIBS'] if s not in env['OPTIONAL_PLUGIN_LIBS'] ] - env.Replace(LIBS=REDUCED_LIBS) - - # Build static library from all source - myobjs = env.SharedObject(sources) - myplugin = env.SharedLibrary(target = pluginname, source = myobjs, SHLIBPREFIX='', SHLIBSUFFIX='.so') - - # Cleaning and installation are restricted to the directory - # scons was launched from or its descendents - CurrentDir = env.Dir('.').srcnode().abspath - if not CurrentDir.startswith(env.GetLaunchDir()): - # Not in launch directory. Tell scons not to clean these targets - env.NoClean([myobjs, myplugin]) - else: - # We're in launch directory (or descendent) schedule installation - - # Installation directories for plugin and headers - installdir = env.subst('$INSTALLDIR') - includedir = "%s/%s" %(env.subst('$INCDIR'), pluginname) - pluginsdir = env.subst('$PLUGINSDIR') - - # Install targets - installed = env.Install(pluginsdir, myplugin) - env.Install(includedir, env.Glob('*.h')+env.Glob('*.hh')+env.Glob('*.hpp')) - -################################## -# swig_library -################################## -def swig_library(env, libname, srcs): - # defaults to building python modules for now - # library name and list of sources have to be specified - if not libname or not srcs: - return - - # make sure that building swig libraries is enabled - try: - if not env['SWIG_EXISTS'] or int(env['SWIG_EXISTS']) != 1: - return - if not env['BUILDSWIG'] or int(env['BUILDSWIG']) != 1: - #print '-- NOTE: swig exists but will not be used unless you --' - #print '-- add "BUILDSWIG=1" to the scons command line. --' - return - except: - return - - # add standard SWIG options - env.AppendUnique(SWIGFLAGS = ["-O"]) - - # set up variables needed for building python extensions - import distutils.sysconfig - so_ext = ".so" - env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()]) - env.AppendUnique(SWIGFLAGS = ["-I"+os.getcwd()]) - - # use LoadableModule() to build the python module, since that properly supports OS X - mylib = env.LoadableModule(libname, srcs, - SHLIBPREFIX="_", - SHLIBSUFFIX=so_ext) - - # Cleaning and installation are restricted to the directory - # scons was launched from or its descendents - CurrentDir = env.Dir('.').srcnode().abspath - if not CurrentDir.startswith(env.GetLaunchDir()): - # Not in launch directory. Tell scons not to clean these targets - env.NoClean([mylib]) - else: - # We're in launch directory (or descendent) schedule installation - - # Installation directories for library and headers - installdir = env.subst('$INSTALLDIR') - includedir = "%s/%s" %(env.subst('$INCDIR'), libname) - libdir = env.subst('$LIBDIR') + "/python" - - # Install targets - the_wrapper = env.Install(libdir, libname+".py") - the_lib = env.Install(libdir, mylib) - env.Depends(the_wrapper, the_lib) - - -#=========================================================== -# Misc utility routines for the SBMS system -#=========================================================== - -################################## -# AddCompileFlags -################################## -def AddCompileFlags(env, allflags): - - # The allflags parameter should be a string containing all - # of the link flags (e.g. what is returned by root-config --cflags) - # It is split on white space and the parameters sorted into - # the 2 lists: ccflags, cpppath - - ccflags = [] - cxxflags = [] - cpppath = [] - for f in allflags.split(): - if f.startswith('-I'): - cpppath.append(f[2:]) - else: - if f == '-g': continue - if f.startswith('-std=c++'): - cxxflags.append(f) - else: - ccflags.append(f) - - if len(ccflags)>0 : - env.AppendUnique(CCFLAGS=ccflags) - - if len(cxxflags)>0 : - env.AppendUnique(CXXFLAGS=cxxflags) - - if len(cpppath)>0 : - env.AppendUnique(CPPPATH=cpppath) - - -################################## -# AddLinkFlags -################################## -def AddLinkFlags(env, allflags): - - # The allflags parameter should be a string containing all - # of the link flags (e.g. what is returned by root-config --glibs) - # It is split on white space and the parameters sorted into - # the 3 lists: linkflags, libpath, and libs - - linkflags = [] - libpath = [] - libs = [] - for f in allflags.split(): - if f.startswith('-L'): - libpath.append(f[2:]) - elif f.startswith('-l'): - libs.append(f[2:]) - else: - linkflags.append(f) - - if len(linkflags)>0 : - env.AppendUnique(LINKFLAGS=linkflags) - - if len(libpath)>0 : - env.AppendUnique(LIBPATH=libpath) - - if len(libs)>0 : - env.AppendUnique(LIBS=libs) - - -################################## -# ReorderCommonLibraries -################################## -def ReorderCommonLibraries(env): - - # Some common libraries are often added by multiple packages - # (e.g. libz is one that many packages use). The gcc4.8.0 - # compiler that comes with Ubuntu13.10 seems particularly - # sensitive to the ordering of the libraries. This means if - # one package "AppendUnique"s the "z" library, it may appear - # too early in the link command for another library that needs - # it, even though the second library tries appending it at the - # end. This routine looks for some commonly used libraries - # in the LIBS variable of the given environment and moves them - # to the end of the list. - - # If LIBS is not defined in this environment, return now - if 'LIBS' not in env.Dictionary(): return - - # If LIBS is not set or is a simple string, return now - if type(env['LIBS']) is not list: return - - libs = ['z', 'bz2', 'pthread', 'm', 'dl'] - for lib in libs: - if lib in env['LIBS']: - env['LIBS'].remove(lib) - env.Append(LIBS=[lib]) - - -################################## -# ApplyPlatformSpecificSettings -################################## -def ApplyPlatformSpecificSettings(env, platform): - - # Look for SBMS file based on this platform and run the InitENV - # function in it to allow for platform-specific settings. Normally, - # the BMS_OSNAME will be passed in which almost certainly contains - # "."s. The Python module loader doesn't like these and we have to - # replace them with "-"s to appease it. - - platform = str(platform) - platform = re.sub('\.', '-', platform) - - modname = "sbms_%s" % platform - if (int(env['SHOWBUILD']) > 0): - print("looking for %s.py" % modname) - try: - InitENV = getattr(__import__(modname), "InitENV") - - # Run the InitENV function (if found) - if(InitENV != None): - print("sbms : Applying settings for platform %s" % platform) - InitENV(env) - - except ImportError as e: - if (int(env['SHOWBUILD']) > 0): print("%s" % e) - pass - - - -################################## -# OptionallyBuild -################################## -def OptionallyBuild(env, dirs): - - # This is used to add directories that are not built as - # part of the standard build, but can still be added - # to the dependency tree so that the user can build them - # by either invoking scons from within the specific source - # directory or by specifying it on the command line. - # - # - - subdirs = [] - for dir in dirs: - add_dir = False - if env.GetLaunchDir().endswith(dir): add_dir = True - #if dir in env['COMMAND_LINE_TARGETS']: add_dir = True - for target in env['COMMAND_LINE_TARGETS']: - if target.endswith(dir): add_dir = True - - if add_dir : subdirs.extend([dir]) - - if len(subdirs)>0 : env.SConscript(dirs=subdirs, exports='env', duplicate=0) - -################################## -# ProgramExists -################################## -def ProgramExists(program): - # this checks the PATH environmental variable to see if a program exists - # it works like the "which" command in UNIX - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) - - fpath, fname = os.path.split(program) - if fpath: - if is_exe(program): - return program - else: - for path in os.environ["PATH"].split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if is_exe(exe_file): - return exe_file - - return None - - -################################## -# IsNotSWIGWrapper -################################## -def IsNotSWIGWrapper(fileNode): - # this function takes an input of type SCons.Node.FS.File - # i.e., what the Environment.Glob() function returns - f = open(fileNode.rstr(),'r') - f.readline() ## the first line is blank - # check to see if the first line of the auto-generated file has some magic - # let's check to see if it contains the string "SWIG" - match = re.search( r'SWIG', f.readline() ) - f.close() - if match: - return False - else: - return True - -#=========================================================== -# Package support follows -#=========================================================== - - -################################## -# JANA -################################## -def AddJANA(env): - jana_home = os.getenv('JANA_HOME', '/no/default/jana/path') - - # Only run jana-config the first time through - if "JANA_CFLAGS" not in AddJANA.__dict__: - AddJANA.JANA_CFLAGS = str(subprocess.Popen(["%s/bin/jana-config" % jana_home,"--jana-only","--cflags"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - AddJANA.JANA_LINKFLAGS = str(subprocess.Popen(["%s/bin/jana-config" % jana_home,"--jana-only","--libs"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - - AddCompileFlags(env, AddJANA.JANA_CFLAGS) - AddLinkFlags(env, AddJANA.JANA_LINKFLAGS) - - -################################## -# HDDS -################################## -def AddHDDS(env): - hdds_home = os.getenv('HDDS_HOME', 'hdds') - env.AppendUnique(CPPPATH = ["%s/%s/src" % (hdds_home, env['OSNAME'])]) - env.AppendUnique(LIBPATH = ["%s/%s/lib" % (hdds_home, env['OSNAME'])]) - - -################################## -# HDDM -################################## -def AddHDDM(env): - env.AppendUnique(LIBS = 'HDDM') - env.PrependUnique(OPTIONAL_PLUGIN_LIBS = 'HDDM') - Add_xstream(env) - -################################## -# MYSQL -################################## -def AddMySQL(env): - - # Only run mysql_config the first time through - if "MYSQL_CFLAGS" not in AddMySQL.__dict__: - AddMySQL.MYSQL_CFLAGS = str(subprocess.Popen(["mysql_config","--cflags"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - AddMySQL.MYSQL_LINKFLAGS = str(subprocess.Popen(["mysql_config","--libs"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - AddCompileFlags(env, AddMySQL.MYSQL_CFLAGS) - AddLinkFlags(env, AddMySQL.MYSQL_LINKFLAGS) - - - -################################## -# DANA -################################## -def AddRECONPaths(env): - halld_recon_home = os.getenv('HALLD_RECON_HOME', 'halld_recon') - env.AppendUnique(CPPPATH = ["%s/%s/include" % (halld_recon_home, env['OSNAME'])]) - env.AppendUnique(LIBPATH = ["%s/%s/lib" % (halld_recon_home, env['OSNAME'])]) - - # skip smearing DIRC if hit object doesn't exist in halld_recon (ie. it's an old version) - if os.path.exists(halld_recon_home+"/src/libraries/DIRC/DDIRCPmtHit.h"): - AddCompileFlags(env, "-DSMEARDIRC") - -################################## -# DANA -################################## -def AddDANA(env): - AddRECONPaths(env) - AddHDDM(env) - AddROOT(env) - AddJANA(env) - AddCCDB(env) - AddRCDB(env) - AddHDDS(env) - AddXERCES(env) - AddEVIO(env) - AddET(env) - AddMySQL(env) # needed for EventStore - DANA_LIBS = "DANA ANALYSIS KINFITTER PID TAGGER TRACKING START_COUNTER" - DANA_LIBS += " CERE DIRC CDC TRIGGER PAIR_SPECTROMETER RF" - DANA_LIBS += " FDC TOF BCAL FCAL CCAL TPOL HDGEOMETRY TTAB FMWPC TAC" - DANA_LIBS += " DAQ JANA EVENTSTORE TRD" - DANA_LIBS += " expat" - env.PrependUnique(LIBS = DANA_LIBS.split()) - env.Append(LIBS = 'DANA') - env.PrependUnique(OPTIONAL_PLUGIN_LIBS = DANA_LIBS.split()) - -################################## -# xstream -################################## -def Add_xstream(env): - env.AppendUnique(CPPPATH = ['#external/xstream/include']) - env.AppendUnique(CPPPATH = ['/usr/include/tirpc']) - env.AppendUnique(CCFLAGS = ['-fPIC']) - env.AppendUnique(LIBS=['xstream', 'tirpc', 'bz2', 'z']) - env.AppendUnique(OPTIONAL_PLUGIN_LIBS = ['xstream', 'bz2', 'z']) - - -################################## -# CCDB -################################## -def AddCCDB(env): - ccdb_home = os.getenv('CCDB_HOME') - if(ccdb_home != None) : - env.AppendUnique(CXXFLAGS = ['-DHAVE_CCDB']) - CCDB_CPPPATH = "%s/include" % (ccdb_home) - CCDB_LIBPATH = "%s/lib" % (ccdb_home) - CCDB_LIBS = "ccdb" - env.AppendUnique(CPPPATH = CCDB_CPPPATH) - env.AppendUnique(LIBPATH = CCDB_LIBPATH) - env.AppendUnique(LIBS = CCDB_LIBS) - -################################## -# SQLite -################################## -def AddSQLite(env): - sqlitecpp_home = os.getenv('SQLITECPP_HOME') - env.Append(CPPDEFINES={'SQLITE_USE_LEGACY_STRUCT':'ON'}) - SQLITECPP_CPPPATH = ["%s/include" % (sqlitecpp_home)] - env.AppendUnique(CPPPATH = SQLITECPP_CPPPATH) - SQLITECPP_LIBPATH = ["%s/lib" % (sqlitecpp_home)] - env.AppendUnique(LIBPATH = SQLITECPP_LIBPATH) - env.AppendUnique(LIBS = 'SQLiteCpp') - sqlite_home = os.getenv('SQLITE_HOME') - if(sqlite_home != None) : - SQLITE_CPPPATH = ["%s/include" % (sqlite_home)] - env.AppendUnique(CPPPATH = SQLITE_CPPPATH) - SQLITE_LIBPATH = ["%s/lib" % (sqlite_home)] - env.AppendUnique(LIBPATH = SQLITE_LIBPATH) - AddSQLite.SQLITE_LINKFLAGS = "-Wl,-rpath=%s/lib" % (sqlite_home) - AddLinkFlags(env, AddSQLite.SQLITE_LINKFLAGS) - env.AppendUnique(LIBS = 'sqlite3') - -################################## -# RCDB -################################## -def AddRCDB(env): - rcdb_home = os.getenv('RCDB_HOME') - if(rcdb_home != None) : - env.AppendUnique(CXXFLAGS = ['-DHAVE_RCDB']) - RCDB_CPPPATH = ["%s/cpp/include" % (rcdb_home)] - env.AppendUnique(CPPPATH = RCDB_CPPPATH) - - # add MySQL - env.Append(CPPDEFINES={'RCDB_MYSQL':1}) - AddMySQL(env) - - # add SQlite - env.Append(CPPDEFINES={'RCDB_SQLITE':1}) - AddSQLite(env) - -################################## -# EVIO -################################## -def AddEVIO(env): - - # Only add EVIO if EVIOROOT is set - evioroot = os.getenv('EVIOROOT') - if(evioroot != None) : - env.AppendUnique(CXXFLAGS = ['-DHAVE_EVIO']) - env.AppendUnique(CPPPATH = ['%s/include' % evioroot]) - env.AppendUnique(LIBPATH = ['%s/lib' % evioroot]) - env.AppendUnique(LIBS=['evioxx', 'evio', 'expat']) - env.AppendUnique(OPTIONAL_PLUGIN_LIBS = ['evioxx', 'evio', 'expat']) - AddET(env) - - -################################## -# ET -################################## -def AddET(env): - - # Only add ET if ETROOT is set - etroot = os.getenv('ETROOT') - if(etroot != None) : - env.AppendUnique(CXXFLAGS = ['-DHAVE_ET']) - env.AppendUnique(CPPPATH = ['%s/include' % etroot]) - env.AppendUnique(LIBPATH = ['%s/lib' % etroot]) - env.AppendUnique(LIBS=['et_remote', 'et']) - env.AppendUnique(OPTIONAL_PLUGIN_LIBS = ['et_remote', 'et']) - - -################################## -# CodaChannels -################################## -def AddCODAChannels(env): - - # Only add codaChannels library if CODA is set - coda = os.getenv('CODA') - arch = os.getenv('ARCH') - etroot = os.getenv('ETROOT') - if(coda == None) : return - if(etroot == None) : return - - AddET(env) - env.AppendUnique(CXXFLAGS = ['-DHAVE_CODACHANNELS']) - env.AppendUnique(CPPPATH = ['%s/%s/include' % (coda,arch)]) - env.AppendUnique(LIBPATH = ['%s/%s/lib' % (coda,arch)]) - env.AppendUnique(LIBS=['codaChannels']) - - -################################## -# CodaObjects -################################## -def AddCODAObjects(env): - - # Only add codaObject library if CODA is set - coda = os.getenv('CODA') - arch = os.getenv('ARCH') - if(coda != None) : - env.AppendUnique(CXXFLAGS = ['-DHAVE_CODAOBJECTS']) - env.AppendUnique(CPPPATH = ['%s/%s/include' % (coda,arch)]) - env.AppendUnique(LIBPATH = ['%s/%s/lib' % (coda,arch)]) - env.AppendUnique(LIBS=['codaObject']) - - -################################## -# CMSG -################################## -def AddCMSG(env): - - # Only add cMsg if CMSGROOT is set - cmsgroot = os.getenv('CMSGROOT', 'none') - if(cmsgroot != 'none') : - env.AppendUnique(CXXFLAGS = ['-DHAVE_CMSG']) - env.AppendUnique(CPPPATH = ['%s/include' % cmsgroot]) - env.AppendUnique(LIBPATH = ['%s/lib' % cmsgroot]) - env.AppendUnique(LIBS=['cmsgxx', 'cmsg', 'cmsgRegex']) - - -################################## -# Xerces -################################## -def AddXERCES(env): - xercescroot = os.getenv('XERCESCROOT', 'xerces') - XERCES_CPPPATH = "%s/include" % (xercescroot) - XERCES_LIBPATH = "%s/lib" % (xercescroot) - XERCES_LIBS = "xerces-c" - env.AppendUnique(CPPPATH = XERCES_CPPPATH) - env.AppendUnique(LIBPATH = XERCES_LIBPATH) - env.AppendUnique(LIBS = XERCES_LIBS) - -################################## -# CERNLIB -################################## -def AddCERNLIB(env): - env.PrependUnique(FORTRANFLAGS = ['-ffixed-line-length-0', '-fno-second-underscore']) - env.PrependUnique(FORTRANFLAGS = ['-fno-automatic', '-fallow-argument-mismatch']) - #env.PrependUnique(FORTRANPATH = ['include']) - cern = os.getenv('CERN', '/usr/local/cern/PRO') - cern_level = os.getenv('CERN_LEVEL', '2006') - cern_root = '%s/%s' % (cern, cern_level) - CERN_FORTRANPATH = "%s/include" % cern_root - CERN_LIBPATH = "%s/lib" % cern_root - env.AppendUnique(FORTRANPATH = [CERN_FORTRANPATH]) - env.AppendUnique(CPPPATH = CERN_FORTRANPATH) - env.AppendUnique(LIBPATH = CERN_LIBPATH) - env.AppendUnique(LINKFLAGS = ['-rdynamic', '-Wl,--no-as-needed']) - env.AppendUnique(LIBS = ['geant321', 'pawlib', 'lapack3', 'blas', 'graflib', 'grafX11', 'packlib', 'mathlib', 'kernlib', 'phtools', 'gfortran', 'X11', 'nsl', 'crypt', 'dl']) - env.SetOption('warn', 'no-fortran-cxx-mix') # supress warnings about linking fortran with c++ - - -################################## -# ROOT -################################## -def AddROOT(env): - # - # Here we use the root-config program to give us the compiler - # and linker options needed for ROOT. We use the AddCompileFlags() - # and AddLinkFlags() routines (defined above) to split the arguments - # into the categories scons wants. E.g. scons wants to know the - # search path and basenames for libraries rather than just giving it - # the full compiler options like "-L/path/to/lib -lmylib". - # - # We also create a builder for ROOT dictionaries and add targets to - # build dictionaries for any headers with "ClassDef" in them. - - rootsys = os.getenv('ROOTSYS', '/usr/local/root/PRO') - if not os.path.isdir(rootsys): - print('ROOTSYS not defined or points to a non-existant directory!') - sys.exit(-1) - - # Only root-config the first time through - if "ROOT_CFLAGS" not in AddROOT.__dict__: - AddROOT.ROOT_CFLAGS = str(subprocess.Popen(["%s/bin/root-config" % rootsys, "--cflags"], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - AddROOT.ROOT_LINKFLAGS = str(subprocess.Popen(["%s/bin/root-config" % rootsys, "--glibs" ], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - has_tmva = str(subprocess.Popen(["%s/bin/root-config" % rootsys, "--has-tmva" ], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - if 'yes' in has_tmva: - AddROOT.ROOT_CFLAGS += ' -DHAVE_TMVA=1' - AddROOT.ROOT_LINKFLAGS += ' -lTMVA' - - AddCompileFlags(env, AddROOT.ROOT_CFLAGS) - AddLinkFlags(env, AddROOT.ROOT_LINKFLAGS) - - if env['OSNAME'].startswith("Darwin_macosx"): - if "llvm" in env['OSNAME']: - AddLinkFlags(env, '-rpath '+rootsys+'/lib') - else: - AddLinkFlags(env, '-Wl,-rpath,'+rootsys+'/lib') - - env.AppendUnique(LIBS = "Geom") - if os.getenv('LD_LIBRARY_PATH' ) != None : env.Append(LD_LIBRARY_PATH = os.environ['LD_LIBRARY_PATH' ]) - if os.getenv('DYLD_LIBRARY_PATH') != None : env.Append(DYLD_LIBRARY_PATH = os.environ['DYLD_LIBRARY_PATH']) - - # NOTE on (DY)LD_LIBRARY_PATH : - # Linux (and most unixes) use LD_LIBRARY_PATH while Mac OS X uses - # DYLD_LIBRARY_PATH. Unfortunately, the "thisroot.csh" script distributed - # with ROOT sets both of these so we can't use the presence of the - # DYLD_LIBRARY_PATH environment variable to decide which of these to - # work with. Thus, we just append to whichever are set, which may be both. - - # Create Builder that can convert .h file into _Dict.cc file - if os.getenv('LD_LIBRARY_PATH' ) != None : env.AppendENVPath('LD_LIBRARY_PATH' , '%s/lib' % rootsys ) - if os.getenv('DYLD_LIBRARY_PATH') != None : env.AppendENVPath('DYLD_LIBRARY_PATH', '%s/lib' % rootsys ) - rootcintpath = "%s/bin/rootcint" % (rootsys) - rootclingpath = "%s/bin/rootcling" % (rootsys) - if env['SHOWBUILD']==0: - rootcintaction = SCons.Script.Action("%s -f $TARGET -c $SOURCE" % (rootcintpath) , 'ROOTCINT [$SOURCE]') - rootclingaction = SCons.Script.Action("%s -f $TARGET -c $SOURCE" % (rootclingpath), 'ROOTCLING [$SOURCE]') - else: - rootcintaction = SCons.Script.Action("%s -f $TARGET -c $SOURCE" % (rootcintpath) ) - rootclingaction = SCons.Script.Action("%s -f $TARGET -c $SOURCE" % (rootclingpath)) - if os.path.exists(rootclingpath) : - bld = SCons.Script.Builder(action = rootclingaction, suffix='_Dict.cc', src_suffix='.h') - elif os.path.exists(rootcintpath): - bld = SCons.Script.Builder(action = rootcintaction, suffix='_Dict.cc', src_suffix='.h') - else: - print('Neither rootcint nor rootcling exists. Unable to create ROOT dictionaries if any encountered.') - return - - env.Append(BUILDERS = {'ROOTDict' : bld}) - - # Generate ROOT dictionary file targets for each header - # containing "ClassDef" - # - # n.b. It seems if scons is run when the build directory doesn't exist, - # then the cwd is set to the source directory. Otherwise, it is the - # build directory. Since the headers will only exist in the source - # directory, we must temporarily cd into that to look for headers that - # we wish to generate dictionaries for. (This took a long time to figure - # out!) - curpath = os.getcwd() - srcpath = env.Dir('.').srcnode().abspath - if(int(env['SHOWBUILD'])>1): - print("---- Scanning for headers to generate ROOT dictionaries in: %s" % srcpath) - os.chdir(srcpath) - for f in glob.glob('*.[h|hh|hpp]'): - if 'ClassDef' in open(f).read(): - env.AppendUnique(ALL_SOURCES = env.ROOTDict(f)) - if(int(env['SHOWBUILD'])>1): - print(" ROOT dictionary for %s" % f) - os.chdir(curpath) - - -################################## -# ROOTSPY -################################## -def AddROOTSpy(env): - rootspy = os.getenv('ROOTSPY') - if(rootspy != None) : - env.AppendUnique(CXXFLAGS = ['-DHAVE_ROOTSPY']) - env.AppendUnique(CPPPATH = ['%s/include' % rootspy, '%s/include/libRootSpy' % rootspy]) - env.AppendUnique(LIBPATH = ['%s/lib' % rootspy]) - env.AppendUnique(LIBS=['RootSpy']) - AddROOT(env) - - - -################################## -# ROOTSPY Macro build function -################################## -def RootSpyMacroCodeGen(target, source, env): - # Used by AddROOTSpyMacros below. See comments there for details - t = '%s' % target[0] - s = '%s' % source[0] - - base = os.path.basename(s[:-2]) - class_name = '%s_rootspy_class' % base - fin = open(s) - fout = open(t, 'w') - - fout.write('#include \n') - fout.write('#include \n') - fout.write('#include \n') - fout.write('using namespace std;\n') - fout.write('static string macro_data=""\n') - for line in fin: - line = line.replace('"', '\\\"') - line = line.replace('\r', '') - line = line.replace('\\#', '\\\#') # used when macro actually wants a "#" in title - fout.write('"%s\\n"\n' % line[:-1]) - fout.write(';\n') - fout.write('class %s{\n' % class_name) - fout.write(' public:\n') - fout.write(' typedef void rmfcn(string, string, string);\n') - fout.write(' %s(){\n' % class_name) - fout.write(' rmfcn* fcn = (rmfcn*)dlsym(RTLD_DEFAULT, "REGISTER_ROOTSPY_MACRO");\n') - fout.write(' if(fcn) (*fcn)("%s","/", macro_data);\n' % base) - fout.write(' }\n') - fout.write('};\n') - fout.write('static %s tmp;' % class_name) - - fin.close() - fout.close() - -################################## -# ROOTSPY Macros -################################## -def AddROOTSpyMacros(env): - # - # This is used to generate a C++ file for each ROOT macro file - # where the complete macro file is embedded as a string. A small - # piece of code is also inserted that allows the string to be - # automatically registered with the RootSpy system, if present. - # (Basically, if the rootspy plugin is attached.) ROOT macros - # are identified by a file ending with a ".C" suffix. The macro - # name will be the basename of the file. - # - - # Create Builder that can convert .C file into _rootspy_macro.cc file - if env['SHOWBUILD']==0: - rootmacroaction = SCons.Script.Action(RootSpyMacroCodeGen, 'ROOTSPY [$SOURCE]') - else: - rootmacroaction = SCons.Script.Action(RootSpyMacroCodeGen) - bld = SCons.Script.Builder(action = rootmacroaction, suffix='_rootspy_macro.cc', src_suffix='.C') - env.Append(BUILDERS = {'ROOTSpyMacro' : bld}) - - # Find all macro files and schedule them to be converted using the above builder - curpath = os.getcwd() - srcpath = env.Dir('.').srcnode().abspath - if(int(env['SHOWBUILD'])>1): - print("---- Looking for ROOT macro files (*.C) in: %s" % srcpath) - os.chdir(srcpath) - for f in glob.glob('*.C'): - env.AppendUnique(ALL_SOURCES = env.ROOTSpyMacro(f)) - if(int(env['SHOWBUILD'])>1) : print(" ROOTSpy Macro for %s" % f) - - os.chdir(curpath) - - -################################## -# SWIG -################################## -def AddSWIG(env): - # SWIG is used to optionally build library wrappers for other languages (e.g. python) - # check to see if the swig executable exists - # if it does, set a variable to let other scripts know - if ProgramExists("swig"): - env.AppendUnique(SWIG_EXISTS = "1") - if not env['BUILDSWIG'] or int(env['BUILDSWIG']) != 1: - print('-- NOTE: swig exists but will not be used unless you --') - print('-- add "BUILDSWIG=1" to the scons command line. --') - else: - env.AppendUnique(SWIG_EXISTS = "0") - # TEMPORARILY DISABLE - #env.Replace(USE_SWIG = "n") - -################################## -# CUDA -################################## -def AddCUDA(env): - CUDA = os.getenv('CUDA_INSTALL_PATH') - if CUDA != None : - - # Create Builder that can compile .cu file into object files - NVCC = '%s/bin/nvcc' % CUDA -# CUDAFLAGS = '-I%s/include -arch=compute_13 -code=compute_13' % CUDA - CUDAFLAGS = ['-g', '-I%s/include' % CUDA] - try: - CUDAFLAGS.extend(env['CUDAFLAGS']) - except: - pass - - CUDAFLAGS_STR = '' - for flag in CUDAFLAGS: CUDAFLAGS_STR = '%s %s' %(CUDAFLAGS_STR, flag) - - if env['SHOWBUILD']==0: - nvccaction = SCons.Script.Action('%s -c %s -o $TARGET $SOURCE' % (NVCC, CUDAFLAGS_STR), 'NVCC [$SOURCE]') - else: - nvccaction = SCons.Script.Action('%s -c %s -o $TARGET $SOURCE' % (NVCC, CUDAFLAGS_STR)) - bld = SCons.Script.Builder(action = nvccaction, suffix='.o', src_suffix='.cu') - env.Append(BUILDERS = {'CUDA' : bld}) - - # Add flags to environment - env.AppendUnique(LIBPATH=['%s/lib' % CUDA, '%s/lib64' % CUDA]) - env.AppendUnique(LIBS=['cublas', 'cudart']) - env.AppendUnique(CPPPATH=['%s/include' % CUDA]) - env.AppendUnique(CXXFLAGS=['-DGPU_ACCELERATION']) - - # Temporarily change to source directory and add all .cu files - curpath = os.getcwd() - srcpath = env.Dir('.').srcnode().abspath - os.chdir(srcpath) - for f in glob.glob('*.cu'): - if env['SHOWBUILD']>0 : print('Adding %s' % f) - env.AppendUnique(MISC_OBJECTS = env.CUDA(f)) - os.chdir(curpath) - - -################################## -# AmpTools -################################## -def AddAmpTools(env): - # Amptools can be downloaded from http://sourceforge.net/projects/amptools/ - # It can be built with GPU support using CUDA (add GPU=1 to command - # line when builidng AmpTools itself). If the CUDA_INSTALL_PATH - # environment variable is set and the $AMPTOOLS/lib/libAmpTools_GPU.a - # file exists then this will automatically use the GPU enabled - # library. Otherwise, the CPU only library will be used. - # If the AMPTOOLS environment variable is not set, then a message is - # printed and env left unchanged. - AMPTOOLS = os.getenv('AMPTOOLS') - if AMPTOOLS==None: - print('') - print('AmpTools is being requested but the AMPTOOLS environment variable') - print('is not set. Expect to see an error message below....') - print('') - else: - env.AppendUnique(CUDAFLAGS=['-I%s -I%s/src/libraries' % (AMPTOOLS, os.getenv('HALLD_SIM_HOME',os.getcwd()))]) - AddCUDA(env) - AMPTOOLS_CPPPATH = "%s" % (AMPTOOLS) - AMPTOOLS_LIBPATH = "%s/lib" % (AMPTOOLS) - AMPTOOLS_LIBS = 'AmpTools' - if os.getenv('CUDA')!=None and os.path.exists('%s/lib/libAmpTools_GPU.a' % AMPTOOLS): - AMPTOOLS_LIBS = 'AmpTools_GPU' - print('Using GPU enabled AMPTOOLS library') - - env.AppendUnique(CXXFLAGS = ['-DHAVE_AMPTOOLS_MCGEN']) - env.AppendUnique(CPPPATH = AMPTOOLS_CPPPATH) - env.AppendUnique(LIBPATH = AMPTOOLS_LIBPATH) - env.AppendUnique(LIBS = AMPTOOLS_LIBS) - - -################################## -# AmpPlotter -################################## -def AddAmpPlotter(env): - ampplotterroot = os.getenv('AMPPLOTTER', 'ampplotter') - AMPPLOTTER_CPPPATH = "%s" % (ampplotterroot) - AMPPLOTTER_LIBPATH = "%s/lib" % (ampplotterroot) - AMPPLOTTER_LIBS = "AmpPlotter" - env.AppendUnique(CPPPATH = AMPPLOTTER_CPPPATH) - env.AppendUnique(LIBPATH = AMPPLOTTER_LIBPATH) - env.AppendUnique(LIBS = AMPPLOTTER_LIBS) - - -################################## -# HepMC -################################## -def AddHepMC(env): - HEPMC_HOME = os.getenv('HEPMCDIR') - if HEPMC_HOME==None: - print('') - print('HepMC is being requested but the HEPMCDIR environment variable is not set!') - print('') - else: - HEPMC_CPPPATH = "%s/include" % (HEPMC_HOME) - HEPMC_LIBPATH = "%s/lib" % (HEPMC_HOME) - HEPMC_LIBS = "HepMC" - env.AppendUnique(CPPPATH = HEPMC_CPPPATH) - env.AppendUnique(LIBPATH = HEPMC_LIBPATH) - env.AppendUnique(LIBS = HEPMC_LIBS) - - -################################## -# PHOTOS -################################## -def AddPhotos(env): - PHOTOS_HOME = os.getenv('PHOTOSDIR') - if PHOTOS_HOME==None: - print('') - print('Photos is being requested but the PHOTOSDIR environment variable is not set!') - print('') - else: - PHOTOS_CPPPATH = "%s/include" % (PHOTOS_HOME) - PHOTOS_LIBPATH = "%s/lib" % (PHOTOS_HOME) - PHOTOS_LIBS = [ "Photospp", "PhotosppHepMC" ] - env.AppendUnique(CXXFLAGS = ['-DEVTGEN_PHOTOS']) - env.AppendUnique(CPPPATH = PHOTOS_CPPPATH) - env.AppendUnique(LIBPATH = PHOTOS_LIBPATH) - env.AppendUnique(LIBS = PHOTOS_LIBS) - - -################################## -# EvtGen -################################## -def AddEvtGen(env): - EVTGEN_HOME = os.getenv('EVTGENDIR') - if EVTGEN_HOME==None: - print('') - print('EvtGen is being requested but the EVTGENDIR environment variable is not set!') - print('') - else: - AddHepMC(env) - AddPhotos(env) - EVTGEN_CPPPATH = "%s/" % (EVTGEN_HOME) - EVTGEN_LIBPATH = [ "%s/lib" % (EVTGEN_HOME), "%s/lib64" % (EVTGEN_HOME) ] # either of these could be true - EVTGEN_LIBS = [ "EvtGen", "EvtGenExternal" ] - EVTGEN_LIBS += [ "EVTGEN_MODELS" ] - env.AppendUnique(CXXFLAGS = ['-DHAVE_EVTGEN', '-DEVTGEN_EXTERNAL']) - env.AppendUnique(CPPPATH = EVTGEN_CPPPATH) - env.AppendUnique(LIBPATH = EVTGEN_LIBPATH) - env.AppendUnique(LIBS = EVTGEN_LIBS) - - -################################## -# Utilities for generators (CCDB and Cobrems) -################################## -def AddUtilities(env): - AddCCDB(env) - pyincludes = str(subprocess.Popen(["python-config", "--includes" ], stdout=subprocess.PIPE).communicate()[0], 'utf-8') - env.AppendUnique(CCFLAGS = pyincludes.rstrip().split()) - # BOOST is required by cobrems and if it is not installed in /usr or /usr/local then we must get it from the environment - boost_root = os.getenv('BOOST_ROOT') - if boost_root != None: - env.AppendUnique(CPPPATH = [boost_root + "/include"]) - diff --git a/src/SConstruct b/src/SConstruct index 623ddf185..03f00b89c 100644 --- a/src/SConstruct +++ b/src/SConstruct @@ -1,4 +1,14 @@ - +from __future__ import division +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals + +from builtins import map +from builtins import str +from builtins import open +from builtins import int +from future import standard_library +standard_library.install_aliases() import os import sys import subprocess @@ -17,6 +27,7 @@ OPTIMIZATION = ARGUMENTS.get('OPTIMIZATION', 2) DEBUG = ARGUMENTS.get('DEBUG', 1) PROFILE = ARGUMENTS.get('PROFILE', 0) BUILDSWIG = ARGUMENTS.get('BUILDSWIG', 0) +PYTHONCONFIG = ARGUMENTS.get('PYTHONCONFIG', 'python-config') # Get platform-specific name osname = os.getenv('BMS_OSNAME', 'build') @@ -52,7 +63,8 @@ env.Replace(INSTALLDIR = installdir, OPTIMIZATION = OPTIMIZATION, DEBUG = DEBUG, BUILDSWIG = BUILDSWIG, - COMMAND_LINE_TARGETS = COMMAND_LINE_TARGETS) + COMMAND_LINE_TARGETS = COMMAND_LINE_TARGETS, + PYTHONCONFIG = PYTHONCONFIG) # Use terse output unless otherwise specified if SHOWBUILD==0: @@ -80,7 +92,7 @@ env.Replace( CXX = os.getenv('CXX', 'c++'), # Get compiler name compiler = 'unknown' -compiler_string = subprocess.Popen([env['CC'],"-v"], stderr=subprocess.PIPE).communicate()[1] +compiler_string = str(subprocess.Popen([env['CC'],"-v"], stderr=subprocess.PIPE).communicate()[1], 'utf-8') if 'clang' in compiler_string: compiler = 'clang' if 'gcc' in compiler_string and 'clang' not in compiler_string: @@ -132,7 +144,7 @@ SConscript(dirs=program_subdirs, variant_dir=".%s/plugins" % (osname), exports=' env.Alias('install', installdir) # Create setenv if user explicitly specified "install" target -build_targets = map(str,BUILD_TARGETS) +build_targets = list(map(str,BUILD_TARGETS)) if len(build_targets)>0 and not env.GetOption('clean'): if 'install' in build_targets: import sbms_setenv diff --git a/src/SConstruct3 b/src/SConstruct3 deleted file mode 100644 index 8305bf364..000000000 --- a/src/SConstruct3 +++ /dev/null @@ -1,199 +0,0 @@ - -import os -import sys -import subprocess -import glob - -# Add SBMS directory to PYTHONPATH -sbmsdir = "%s/SBMS" % (os.getcwd()) -sys.path.append(sbmsdir) - -import sbms - -# Get command-line options -SHOWBUILD = ARGUMENTS.get('SHOWBUILD', 0) -SHOWPROGRESS = ARGUMENTS.get('SHOWPROGRESS', 1) -OPTIMIZATION = ARGUMENTS.get('OPTIMIZATION', 2) -DEBUG = ARGUMENTS.get('DEBUG', 1) -PROFILE = ARGUMENTS.get('PROFILE', 0) -BUILDSWIG = ARGUMENTS.get('BUILDSWIG', 0) - -# Get platform-specific name -osname = os.getenv('BMS_OSNAME', 'build') - -# Get architecture name -arch = ROOT_CFLAGS = subprocess.Popen(["uname"], stdout=subprocess.PIPE).communicate()[0].strip() - -# Setup initial environment -installdir = "#../%s" %(osname) -include = "%s/include" % (installdir) -bin = "%s/bin" % (installdir) -lib = "%s/lib" % (installdir) -plugins = "%s/plugins" % (installdir) -python2 = "%s/python2" % (installdir) -python3 = "%s/python3" % (installdir) -env = Environment( ENV = os.environ, # Bring in full environement, including PATH - CPPPATH = [include], - LIBPATH = [lib], - variant_dir = ".%s" % (osname)) - -# These are SBMS-specific variables (i.e. not default scons ones) -env.Replace(INSTALLDIR = installdir, - OSNAME = osname, - INCDIR = include, - BINDIR = bin, - LIBDIR = lib, - PLUGINSDIR = plugins, - PYTHON2DIR = python2, - PYTHON3DIR = python3, - ALL_SOURCES = [], # used so we can add generated sources - MISC_OBJECTS = [], # used so we can add custom built objects - SHOWBUILD = SHOWBUILD, - OPTIMIZATION = OPTIMIZATION, - DEBUG = DEBUG, - BUILDSWIG = BUILDSWIG, - COMMAND_LINE_TARGETS = COMMAND_LINE_TARGETS) - -# Use terse output unless otherwise specified -if SHOWBUILD==0: - env.Replace(CCCOMSTR = "Compiling [$SOURCE]", - CXXCOMSTR = "Compiling [$SOURCE]", - FORTRANPPCOMSTR = "Compiling [$SOURCE]", - FORTRANCOMSTR = "Compiling [$SOURCE]", - SHCCCOMSTR = "Compiling [$SOURCE]", - SHCXXCOMSTR = "Compiling [$SOURCE]", - LINKCOMSTR = "Linking [$TARGET]", - SHLINKCOMSTR = "Linking [$TARGET]", - INSTALLSTR = "Installing [$TARGET]", - ARCOMSTR = "Archiving [$TARGET]", - RANLIBCOMSTR = "Ranlib [$TARGET]") # nb RANLIBCOMSTR modified in progress functions below - -# Ranlib is special since it displays right after archiving without -# calling the progress_function -if int(SHOWPROGRESS) == 1 : env.Replace(RANLIBCOMSTR = "[ -- ] Ranlib [$TARGET]") - - -# Get compiler from environment variables (if set) -env.Replace( CXX = os.getenv('CXX', 'c++'), - CC = os.getenv('CC' , 'cc'), - FC = os.getenv('FC' , 'gfortran') ) - -# Get compiler name -compiler = 'unknown' -compiler_string = str(subprocess.Popen([env['CC'],"-v"], stderr=subprocess.PIPE).communicate()[1], 'utf-8') -if 'clang' in compiler_string: - compiler = 'clang' -if 'gcc' in compiler_string and 'clang' not in compiler_string: - compiler = 'gcc' -env.Replace(COMPILER = compiler) - -# Add libraries and libraries/include to include search path -env.PrependUnique(CPPPATH = ['#', '#libraries', '#libraries/include']) - -# Use C++11 -env.PrependUnique( CXXFLAGS = ['-std=c++11']) - -# Standard flags (optimization level and warnings) -env.PrependUnique( CFLAGS = ['-O%s' % OPTIMIZATION, '-fPIC', '-Wall']) -env.PrependUnique( CXXFLAGS = ['-O%s' % OPTIMIZATION, '-fPIC', '-Wall']) -env.PrependUnique(FORTRANFLAGS = ['-O%s' % OPTIMIZATION, '-fPIC', '-Wall']) - -# Turn on debug symbols unless user told us not to -if not DEBUG=='0': - env.PrependUnique( CFLAGS = ['-g']) - env.PrependUnique( CXXFLAGS = ['-g']) - env.PrependUnique(FORTRANFLAGS = ['-g']) - -# Turn on profiling if user asked for it -if PROFILE=='1': - env.PrependUnique( CFLAGS = ['-pg']) - env.PrependUnique( CXXFLAGS = ['-pg']) - env.PrependUnique(FORTRANFLAGS = ['-pg']) - env.PrependUnique( LINKFLAGS = ['-pg']) - -# Apply any platform/architecture specific settings -sbms.ApplyPlatformSpecificSettings(env, arch) -sbms.ApplyPlatformSpecificSettings(env, osname) - - - -# build libraries -SConscript('libraries/SConscript', variant_dir=".%s/libraries" % (osname), exports='env osname', duplicate=0) - -# build programs -program_subdirs = ['programs'] -SConscript(dirs=program_subdirs, variant_dir=".%s/programs" % (osname), exports='env osname', duplicate=0) - -# build plugins -program_subdirs = ['plugins'] -SConscript(dirs=program_subdirs, variant_dir=".%s/plugins" % (osname), exports='env osname', duplicate=0) - -# Make install target -env.Alias('install', installdir) - -# Create setenv if user explicitly specified "install" target -build_targets = list(map(str,BUILD_TARGETS)) -if len(build_targets)>0 and not env.GetOption('clean'): - if 'install' in build_targets: - import sbms_setenv - sbms_setenv.mk_setenv_csh(env) - sbms_setenv.mk_setenv_bash(env) - -#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# The following is used to print the percent done on each line -# if requested by the user. This is not a perfect system since -# it requires the total number of nodes to calculate percentage. -# That is not available from scons directly and must be remembered -# from a previous build. We write this to a file named ".scons_node_count" -# in the platform specfic build directory. This is a combination -# of info found in scons documentaion on the Progress() function -# and a StackOverflow post (16568673) describing the technique and -# a second StackOverflow post (8901296) describing how to implement -# a "finish" routine. -screen = None -try: - screen = open('/dev/tty', 'w') -except: pass -node_count = 0 -node_count_max = 0 -node_count_interval = 1 -node_count_fname = str(env.Dir('#.%s' % osname)) + '/.scons_node_count' - -def progress_function(node): - global node_count, node_count_max, node_count_interval, node_count_fname - node_count += node_count_interval - if node_count > node_count_max: node_count_max = 0 - if node_count_max>0 and screen: - screen.write('\r[%3d%%] ' % (node_count*100/node_count_max)) - screen.flush() - -def build_complete(target, source, env): - global node_count - with open(node_count_fname, 'w') as f: f.write('%d\n' % node_count) - -# Build behavior is not as expected if no other targets are specified -# and we add the build_complete target. Similar to when cleaning -# except that doesn't show up in the build targets, but as an option. -# Check that we building something and not cleaning and that the user -# did not specify no progress before setting this up. -show_ticker = int(SHOWPROGRESS) == 1 -show_ticker &= not env.GetOption('clean') -show_ticker &= len(BUILD_TARGETS)>0 -if show_ticker : - # Open file (if available) and read node count from last build - try: - with open(node_count_fname) as f: node_count_max = int(f.readline()) - except: pass - - # Register progress function - Progress(progress_function, interval=node_count_interval) - - # Add command to execute at end of build that writes node count to file - progress_finish_loc = str(env.Dir('#/..'))+'/sbms_build_complete' - progress_finish_command = Command(progress_finish_loc, [], build_complete) - Depends(progress_finish_command, BUILD_TARGETS) - if progress_finish_loc not in BUILD_TARGETS: BUILD_TARGETS.append(progress_finish_loc) - - -# end section on progress counter -#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/programs/Simulation/gen_primex_compton/SConscript b/src/programs/Simulation/gen_primex_compton/SConscript index 8123f0c61..ee63ad824 100644 --- a/src/programs/Simulation/gen_primex_compton/SConscript +++ b/src/programs/Simulation/gen_primex_compton/SConscript @@ -10,9 +10,9 @@ SConscript(dirs=['sd_compton','run'], exports='env osname', duplicate=0) # Verify CERN environment variable is set if os.getenv('CERN', 'nada')=='nada': if env.Dir('.').srcnode().abspath.startswith(env.GetLaunchDir()): - print '============================================================' - print 'CERN environment variable not set. Skipping build of bggen' - print '============================================================' + print('============================================================') + print('CERN environment variable not set. Skipping build of bggen') + print('============================================================') else: diff --git a/src/programs/Simulation/gen_primex_compton/run/SConscript b/src/programs/Simulation/gen_primex_compton/run/SConscript index 6305207f3..0d126edfb 100644 --- a/src/programs/Simulation/gen_primex_compton/run/SConscript +++ b/src/programs/Simulation/gen_primex_compton/run/SConscript @@ -9,9 +9,9 @@ Import('*') # Verify CERN environment variable is set if os.getenv('CERN', 'nada')=='nada': if env.Dir('.').srcnode().abspath.startswith(env.GetLaunchDir()): - print '============================================================' - print 'CERN environment variable not set. Skipping build of bggen' - print '============================================================' + print('============================================================') + print('CERN environment variable not set. Skipping build of bggen') + print('============================================================') else: diff --git a/src/programs/Simulation/gen_primex_compton/sd_compton/SConscript b/src/programs/Simulation/gen_primex_compton/sd_compton/SConscript index 442e45af9..906f1322f 100644 --- a/src/programs/Simulation/gen_primex_compton/sd_compton/SConscript +++ b/src/programs/Simulation/gen_primex_compton/sd_compton/SConscript @@ -8,9 +8,9 @@ Import('*') # Verify CERN environment variable is set if os.getenv('CERN', 'nada')=='nada': if env.Dir('.').srcnode().abspath.startswith(env.GetLaunchDir()): - print '=============================================================' - print 'CERN environment variable not set. Skipping build of comptrc0' - print '=============================================================' + print('=============================================================') + print('CERN environment variable not set. Skipping build of comptrc0') + print('=============================================================') else: @@ -21,7 +21,7 @@ else: sbms.AddCERNLIB(env) env.Append(LIBS=File('lib/libkernlib.a')) - env.Append(LIBS=File('lib/libpawlib.a')) + env.Append(LIBS=File('lib/libpawlib.a')) env.Append(LIBS=File('lib/libgraflib.a')) env.Append(LIBS=File('lib/libgrafX11.a')) env.Append(LIBS=File('lib/libmathlib.a'))