| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
make_heptools.HepToolsGenerator Class Reference
Inheritance diagram for make_heptools.HepToolsGenerator:
[legend]
Collaboration diagram for make_heptools.HepToolsGenerator:
[legend]

## 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"}

## Detailed Description

    Class wrapping the details needed to generate the toolchain file from LCGCMT.

Definition at line 10 of file make_heptools.py.

## Constructor & Destructor Documentation

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 54 of file make_heptools.py.

54
55 def __init__(self, lcgcmt_root):
56 """
57 Prepare the instance.
58
59 @param lcgcmt_root: path to the root directory of a given LCGCMT version
60 """
61 self.lcgcmt_root = lcgcmt_root

## Member Function Documentation

def make_heptools.HepToolsGenerator.__repr__ | ( |  | self | ) |

    Representation of the instance.

Definition at line 62 of file make_heptools.py.

62
63 def __repr__(self):
64 """
65 Representation of the instance.
66 """
67 return "HepToolsGenerator(%r)" % self.lcgcmt_root

def make_heptools.HepToolsGenerator.__str__ | ( |  | self | ) |

    Return the content of the toolchain file.

Definition at line 178 of file make_heptools.py.

178
179 def __str__(self):
180 """
181 Return the content of the toolchain file.
182 """
183 return "\n".join(self._content())

def make_heptools.HepToolsGenerator._content | ( |  | self | ) |
| private

    Generator producing the content (in blocks) of the toolchain file.

Definition at line 131 of file make_heptools.py.

131
132 def _content(self):
133 """
134 Generator producing the content (in blocks) of the toolchain file.
135 """
136 versions = self.versions
137
138 yield self.__header__ % versions.pop("LCG")
139
140 yield "\n# Application Area Projects"
141 for name in self.__AA_projects__:
142 # the width of the first string is bound to the length of the names
143 # in self.__AA_projects__
144 yield "LCG_AA_project(%-5s %s)" % (name, versions.pop(name))
145
146 yield "\n# Compilers"
147 # @FIXME: to be made cleaner and more flexible
148 for compiler in [("gcc43", "gcc", "4.3.5"),
149 ("gcc46", "gcc", "4.6.2"),
150 ("gcc47", "gcc", "4.7.2"),
151 ("clang30", "clang", "3.0"),
152 ("gccmax", "gcc", "4.7.2")]:
153 yield "LCG_compiler(%s %s %s)" % compiler
154
155 yield "\n# Externals"
156 lengths = (max(map(len, versions.keys())),
157 max(map(len, versions.values())),
158 max(map(len, self.__special_dirs__.values()))
159 )
160 template = "LCG_external_package(%%-%ds %%-%ds %%-%ds)" % lengths
161
162 def packageSorting(pkg):
163 "special package sorting keys"
164 key = pkg.lower()
165 if key == "javajni":
166 key = "javasdk_javajni"
167 return key
168 for name in sorted(versions.keys(), key=packageSorting):
169 # special case
170 if name == "uuid":
171 yield "if(NOT ${LCG_OS}${LCG_OS_VERS} STREQUAL slc6) # uuid is not distributed with SLC6"
172 # LCG_external_package(CLHEP 1.9.4.7 clhep)
173 yield template % (name, versions[name], self.__special_dirs__.get(name, ""))
174 if name == "uuid":
175 yield "endif()"
176
177 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 69 of file make_heptools.py.

69
70 def versions(self):
71 """
72 Extract the external names and versions from an installed LCGCMT.
73
74 @return: dictionary mapping external names to versions
75 """
76 from itertools import imap
77 def statements(lines):
78 """
79 Generator of CMT statements from a list of lines.
80 """
81 statement = "" # we start with an empty statement
82 for l in imap(lambda l: l.rstrip(), lines): # CMT ignores spaces at the end of line when checking for '\'
83 # append the current line to the statement so far
84 statement += l
85 if statement.endswith("\\"):
86 # in this case we need to strip the '\' and continue the concatenation
87 statement = statement[:-1]
88 else:
89 # we can stop concatenating, but we return only non-trivial statements
90 statement = statement.strip()
91 if statement:
92 yield statement
93 statement = "" # we start collecting a new statement
94
95 def tokens(statement):
96 """
97 Split a statement in tokens.
98
99 Trivial implementation assuming the tokens do not contain spaces.
100 """
101 return statement.split()
102
103 def macro(args):
104 """
105 Analyze the arguments of a macro command.
106
107 @return: tuple (name, value, exceptionsDict)
108 """
109 unquote = lambda s: s.strip('"')
110 name = args[0]
111 value = unquote(args[1])
112 # make a dictionary of the even to odd remaining args (unquoting the values)
113 exceptions = dict(zip(args[2::2],
114 map(unquote, args[3::2])))
115 return name, value, exceptions
116
117 # prepare the dictionary for the results
118 versions = {}
119 # We extract the statements from the requirements file of the LCG_Configuration package
120 req = open(os.path.join(self.lcgcmt_root, "LCG_Configuration", "cmt", "requirements"))
121 for toks in imap(tokens, statements(req)):
122 if toks.pop(0) == "macro": # get only the macros ...
123 name, value, exceptions = macro(toks)
124 if name.endswith("_config_version"): # that end with _config_version
125 name = name[:-len("_config_version")]
126 name = self.__special_names__.get(name, name)
127 for tag in ["target-slc"]: # we use the alternative for 'target-slc' if present
128 value = exceptions.get(tag, value)
129 versions[name] = value.replace('(', '{').replace(')', '}')
130 return versions

## Member Data Documentation

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

Initial value:
1 """cmake_minimum_required(VERSION 2.8.5)
2
3 # Declare the version of HEP Tools we use
4 # (must be done before including heptools-common to allow evolution of the
5 # structure)
6 set(heptools_version %s)
7
8 include(${CMAKE_CURRENT_LIST_DIR}/heptools-common.cmake)
9
10 # please keep alphabetic order and the structure (tabbing).
11 # it makes it much easier to edit/read this file!
12 """

Definition at line 14 of file make_heptools.py.

dictionary make_heptools.HepToolsGenerator.__special_dirs__
| static private

Initial value:
1 {"CLHEP": "clhep",
2 "fftw": "fftw3",
3 "Frontier_Client": "frontier_client",
4 "GCCXML": "gccxml",
5 "Qt": "qt",
6 "CASTOR": "castor",
7 "TBB": "tbb",
8 "cgsigsoap": "Grid/cgsi-gsoap",
9 "epel": "Grid/epel",
10 "gfal": "Grid/gfal",
11 "globus": "Grid/globus",
12 "gridftp_ifce": "Grid/gridftp-ifce",
13 "is_ifce": "Grid/is-ifce",
14 "lcgdmcommon": "Grid/lcg-dm-common",
15 "lfc": "Grid/LFC",
16 "srm_ifce": "Grid/srm-ifce",
17 "vomsapic": "Grid/voms-api-c",
18 "voms": "Grid/voms",
19 }

Definition at line 32 of file make_heptools.py.

dictionary make_heptools.HepToolsGenerator.__special_names__ {"qt": "Qt"}
| static private

Definition at line 52 of file make_heptools.py.

string make_heptools.HepToolsGenerator.__trailer__
| static private

Initial value:
1 """
2 # Prepare the search paths according to the versions above
3 LCG_prepare_paths()"""

Definition at line 26 of file make_heptools.py.

make_heptools.HepToolsGenerator.lcgcmt_root

Definition at line 60 of file make_heptools.py.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/cmake/toolchain/make_heptools.py