|
Gaudi Framework, version v23r4 |
| Home | Generated: Mon Sep 17 2012 |

Public Member Functions | |
| def | __init__ |
| def | __repr__ |
| def | versions |
| def | __str__ |
Public Attributes | |
| lcgcmt_root | |
Private Member Functions | |
| def | _content |
Static Private Attributes | |
| string | __header__ |
| string | __trailer__ |
| tuple | __AA_projects__ = ("COOL", "CORAL", "RELAX", "ROOT") |
| dictionary | __special_dirs__ |
| dictionary | __special_names__ = {"qt": "Qt"} |
Class wrapping the details needed to generate the toolchain file from LCGCMT.
Definition at line 10 of file make_heptools.py.
| def make_heptools::HepToolsGenerator::__init__ | ( | self, | |
| lcgcmt_root | |||
| ) |
Prepare the instance. @param lcgcmt_root: path to the root directory of a given LCGCMT version
Definition at line 43 of file make_heptools.py.
00044 : 00045 """ 00046 Prepare the instance. 00047 00048 @param lcgcmt_root: path to the root directory of a given LCGCMT version 00049 """ 00050 self.lcgcmt_root = lcgcmt_root
| def make_heptools::HepToolsGenerator::__repr__ | ( | self ) |
Representation of the instance.
Definition at line 51 of file make_heptools.py.
| def make_heptools::HepToolsGenerator::__str__ | ( | self ) |
Return the content of the toolchain file.
Definition at line 167 of file make_heptools.py.
| def make_heptools::HepToolsGenerator::_content | ( | self ) | [private] |
Generator producing the content (in blocks) of the toolchain file.
Definition at line 120 of file make_heptools.py.
00121 : 00122 """ 00123 Generator producing the content (in blocks) of the toolchain file. 00124 """ 00125 versions = self.versions 00126 00127 yield self.__header__ % versions.pop("LCG") 00128 00129 yield "\n# Application Area Projects" 00130 for name in self.__AA_projects__: 00131 # the width of the first string is bound to the length of the names 00132 # in self.__AA_projects__ 00133 yield "LCG_AA_project(%-5s %s)" % (name, versions.pop(name)) 00134 00135 yield "\n# Compilers" 00136 # @FIXME: to be made cleaner and more flexible 00137 for compiler in [("gcc43", "gcc", "4.3.5"), 00138 ("gcc46", "gcc", "4.6.2"), 00139 ("gcc47", "gcc", "4.7.0"), 00140 ("clang30", "clang", "3.0"), 00141 ("gccmax", "gcc", "4.7.0")]: 00142 yield "LCG_compiler(%s %s %s)" % compiler 00143 00144 yield "\n# Externals" 00145 lengths = (max(map(len, versions.keys())), 00146 max(map(len, versions.values())), 00147 max(map(len, self.__special_dirs__.values())) 00148 ) 00149 template = "LCG_external_package(%%-%ds %%-%ds %%-%ds)" % lengths 00150 00151 def packageSorting(pkg): 00152 "special package sorting keys" 00153 key = pkg.lower() 00154 if key == "javajni": 00155 key = "javasdk_javajni" 00156 return key 00157 for name in sorted(versions.keys(), key=packageSorting): 00158 # special case 00159 if name == "uuid": 00160 yield "if(NOT ${os} STREQUAL slc6) # uuid is not distributed with SLC6" 00161 # LCG_external_package(CLHEP 1.9.4.7 clhep) 00162 yield template % (name, versions[name], self.__special_dirs__.get(name, "")) 00163 if name == "uuid": 00164 yield "endif()" 00165 00166 yield self.__trailer__
| def make_heptools::HepToolsGenerator::versions | ( | self ) |
Extract the external names and versions from an installed LCGCMT. @return: dictionary mapping external names to versions
Definition at line 58 of file make_heptools.py.
00059 : 00060 """ 00061 Extract the external names and versions from an installed LCGCMT. 00062 00063 @return: dictionary mapping external names to versions 00064 """ 00065 from itertools import imap 00066 def statements(lines): 00067 """ 00068 Generator of CMT statements from a list of lines. 00069 """ 00070 statement = "" # we start with an empty statement 00071 for l in imap(lambda l: l.rstrip(), lines): # CMT ignores spaces at the end of line when checking for '\' 00072 # append the current line to the statement so far 00073 statement += l 00074 if statement.endswith("\\"): 00075 # in this case we need to strip the '\' and continue the concatenation 00076 statement = statement[:-1] 00077 else: 00078 # we can stop concatenating, but we return only non-trivial statements 00079 statement = statement.strip() 00080 if statement: 00081 yield statement 00082 statement = "" # we start collecting a new statement 00083 00084 def tokens(statement): 00085 """ 00086 Split a statement in tokens. 00087 00088 Trivial implementation assuming the tokens do not contain spaces. 00089 """ 00090 return statement.split() 00091 00092 def macro(args): 00093 """ 00094 Analyze the arguments of a macro command. 00095 00096 @return: tuple (name, value, exceptionsDict) 00097 """ 00098 unquote = lambda s: s.strip('"') 00099 name = args[0] 00100 value = unquote(args[1]) 00101 # make a dictionary of the even to odd remaining args (unquoting the values) 00102 exceptions = dict(zip(args[2::2], 00103 map(unquote, args[3::2]))) 00104 return name, value, exceptions 00105 00106 # prepare the dictionary for the results 00107 versions = {} 00108 # We extract the statements from the requirements file of the LCG_Configuration package 00109 req = open(os.path.join(self.lcgcmt_root, "LCG_Configuration", "cmt", "requirements")) 00110 for toks in imap(tokens, statements(req)): 00111 if toks.pop(0) == "macro": # get only the macros ... 00112 name, value, exceptions = macro(toks) 00113 if name.endswith("_config_version"): # that end with _config_version 00114 name = name[:-len("_config_version")] 00115 name = self.__special_names__.get(name, name) 00116 for tag in ["target-slc"]: # we use the alternative for 'target-slc' if present 00117 value = exceptions.get(tag, value) 00118 versions[name] = value.replace('(', '{').replace(')', '}') 00119 return versions
tuple make_heptools::HepToolsGenerator::__AA_projects__ = ("COOL", "CORAL", "RELAX", "ROOT") [static, private] |
Definition at line 30 of file make_heptools.py.
string make_heptools::HepToolsGenerator::__header__ [static, private] |
"""cmake_minimum_required(VERSION 2.8.5) # Declare the version of HEP Tools we use # (must be done before including heptools-common to allow evolution of the # structure) set(heptools_version %s) include(${CMAKE_CURRENT_LIST_DIR}/heptools-common.cmake) # please keep alphabetic order and the structure (tabbing). # it makes it much easier to edit/read this file! """
Definition at line 14 of file make_heptools.py.
dictionary make_heptools::HepToolsGenerator::__special_dirs__ [static, private] |
{"CLHEP": "clhep",
"fftw": "fftw3",
"Frontier_Client": "frontier_client",
"GCCXML": "gccxml",
"Qt": "qt",
"CASTOR": "castor",
"lfc": "Grid/LFC",
}
Definition at line 32 of file make_heptools.py.
dictionary make_heptools::HepToolsGenerator::__special_names__ = {"qt": "Qt"} [static, private] |
Definition at line 41 of file make_heptools.py.
string make_heptools::HepToolsGenerator::__trailer__ [static, private] |
""" # Prepare the search paths according to the versions above LCG_prepare_paths()"""
Definition at line 26 of file make_heptools.py.
Definition at line 47 of file make_heptools.py.