22 for file
in filenames:
24 if file.lower().
find(
"linkdef" ) != -1
or file.lower().
find(
"dict" ) != -1:
27 if file.endswith(
".h" )
or file.endswith(
".icc" ):
28 header_files += [ file ]
31 if file.endswith(
".cxx" )
or file.endswith(
".cpp" )
or file.endswith(
".C" ):
32 source_files += [ file ]
37 return ( header_files, source_files )
52 for file
in filenames:
54 if file.lower().
find(
"linkdef" ) != -1
or file.lower().
find(
"dict" ) != -1:
57 if ( file.find(
"VarHandle.h" ) != -1
or
58 file.find(
"VarHandle.icc" ) != -1
or
59 file.find(
"VarProxy.h" ) != -1
or
60 file.find(
"VarProxy.icc" ) != -1 ):
63 if file.endswith(
".h" ):
64 header_files += [ file ]
83 from AthenaCommon.Logging
import logging
84 logger = logging.getLogger(
"dictionaryClasses" )
87 classnames = [
"D3PDReader::VarHandleBase",
88 "D3PDReader::VarProxyBase",
89 "D3PDReader::VariableStats",
90 "D3PDReader::D3PDReadStats",
91 "map<TString,D3PDReader::VariableStats>",
92 "pair<TString,D3PDReader::VariableStats>",
93 "map<TString,D3PDReader::VarHandleBase*>",
94 "pair<TString,D3PDReader::VarHandleBase*>",
95 "D3PDReader::UserD3PDObjectElement",
96 "D3PDReader::UserD3PDObject" ]
97 for header
in filenames:
99 hfile =
open( header,
"rU" )
101 logger.error(
"Couldn't open header file: %s", hfile )
105 m1 = re.match(
r".*ClassDef\( (\w+), 0 \)", line )
106 m2 = re.match(
".*(VarHandle< .* >).*", line )
107 m3 = re.match(
".*(VarProxy< .* >).*", line )
109 if not (
"D3PDReader::" + m1.group( 1 ) )
in classnames:
110 logger.verbose(
"Found class: " + m1.group( 1 ) )
111 classnames += [
"D3PDReader::" + m1.group( 1 ) ]
115 if m2.group( 1 ) ==
"VarHandle< T >":
continue
116 if not (
"D3PDReader::" + m2.group( 1 ) )
in classnames:
117 logger.verbose(
"Found class: " + m2.group( 1 ) )
118 classnames += [
"D3PDReader::" + m2.group( 1 ) ]
122 if m3.group( 1 ) ==
"VarProxy< T >":
continue
123 if not (
"D3PDReader::" + m3.group( 1 ) )
in classnames:
124 logger.verbose(
"Found class: " + m3.group( 1 ) )
125 classnames += [
"D3PDReader::" + m3.group( 1 ) ]
135 for cname
in classnames:
137 cname = re.sub(
r"std::",
"", cname )
139 cname = re.sub(
r"\s",
"", cname )
141 cname = re.sub(
r",allocator<\w*>",
"", cname )
142 cname = re.sub(
r",allocator<\w*<\w*>>",
"", cname )
143 cname = re.sub(
r",allocator<\w*<\w*<\w*>>>",
"", cname )
146 cname = re.sub(
r"unsigned",
"unsigned ", cname )
151 cname = re.sub(
r"long(?!>)",
"long ", cname )
153 while cname != re.sub(
r">>",
"> >", cname ):
154 cname = re.sub(
r">>",
"> >", cname )
156 finalnames += [ cname ]
175 from AthenaCommon.Logging
import logging
176 logger = logging.getLogger(
"writeLinkDefFile" )
179 linkdef =
open( filename,
"w" )
181 logger.error(
"Couldn't open %s for writing!", filename )
184 logger.info(
"Writing linkdef file to: %s", filename )
188 linkdef.write(
"// Dear emacs, this is -*- c++ -*-\n" )
189 linkdef.write(
"// $Id: Helpers.py 600807 2014-06-08 15:26:51Z krasznaa $\n" )
190 linkdef.write(
"#ifndef D3PDREADER_LINKDEF_H\n" )
191 linkdef.write(
"#define D3PDREADER_LINKDEF_H\n\n" )
194 for header
in headers:
195 linkdef.write(
"#include \"%s\"\n" % header )
199 linkdef.write(
"\n#ifdef __CINT__\n\n" )
200 linkdef.write(
"#pragma link off all globals;\n" )
201 linkdef.write(
"#pragma link off all classes;\n" )
202 linkdef.write(
"#pragma link off all functions;\n\n" )
203 linkdef.write(
"#pragma link C++ nestedclass;\n\n" )
206 for classname
in classnames:
207 linkdef.write(
"#pragma link C++ class %s+;\n" % classname )
211 linkdef.write(
"\n" )
212 linkdef.write(
"// You can disable the remaining lines if you don't\n" )
213 linkdef.write(
"// plan to use the library in CINT or PyROOT.\n" )
214 functions = [
"D3PDReader::UserD3PDObject::DeclareVariable<bool>",
215 "D3PDReader::UserD3PDObject::DeclareVariable<short>",
216 "D3PDReader::UserD3PDObject::DeclareVariable<unsigned short>",
217 "D3PDReader::UserD3PDObject::DeclareVariable<int>",
218 "D3PDReader::UserD3PDObject::DeclareVariable<unsigned int>",
219 "D3PDReader::UserD3PDObject::DeclareVariable<long long>",
220 "D3PDReader::UserD3PDObject::DeclareVariable<unsigned long long>",
221 "D3PDReader::UserD3PDObject::DeclareVariable<float>",
222 "D3PDReader::UserD3PDObject::DeclareVariable<double>",
231 "D3PDReader::UserD3PDObject::Variable<bool>",
232 "D3PDReader::UserD3PDObject::Variable<short>",
233 "D3PDReader::UserD3PDObject::Variable<unsigned short>",
234 "D3PDReader::UserD3PDObject::Variable<int>",
235 "D3PDReader::UserD3PDObject::Variable<unsigned int>",
236 "D3PDReader::UserD3PDObject::Variable<long long>",
237 "D3PDReader::UserD3PDObject::Variable<unsigned long long>",
238 "D3PDReader::UserD3PDObject::Variable<float>",
239 "D3PDReader::UserD3PDObject::Variable<double>",
248 "D3PDReader::UserD3PDObjectElement::Variable<short>",
249 "D3PDReader::UserD3PDObjectElement::Variable<unsigned short>",
250 "D3PDReader::UserD3PDObjectElement::Variable<int>",
251 "D3PDReader::UserD3PDObjectElement::Variable<unsigned int>",
252 "D3PDReader::UserD3PDObjectElement::Variable<long long>",
253 "D3PDReader::UserD3PDObjectElement::Variable<unsigned long long>",
254 "D3PDReader::UserD3PDObjectElement::Variable<float>",
255 "D3PDReader::UserD3PDObjectElement::Variable<double>" ]
256 for function
in functions:
257 linkdef.write(
"#pragma link C++ function %s;\n" % function )
261 linkdef.write(
"\n" )
262 linkdef.write(
"#endif // __CINT__\n" )
263 linkdef.write(
"#endif // D3PDREADER_LINKDEF_H\n" )
282 from AthenaCommon.Logging
import logging
283 logger = logging.getLogger(
"makeRootCorePackageSkeleton" )
287 if not os.path.exists( directory ):
288 logger.error(
"The output directory (%s) doesn't exist!", directory )
292 if os.path.exists( directory +
"/" + name ):
293 logger.error(
"The directory for the package (%s/%s) already exists!", directory, name )
298 os.mkdir( directory +
"/" + name, 0o755 )
299 os.mkdir( directory +
"/" + name +
"/" + name, 0o755 )
300 os.mkdir( directory +
"/" + name +
"/Root", 0o755 )
301 os.mkdir( directory +
"/" + name +
"/cmt", 0o755 )
304 makefile =
open( directory +
"/" + name +
"/cmt/Makefile.RootCore",
"w" )
305 makefile.write(
"# $Id: Helpers.py 600807 2014-06-08 15:26:51Z krasznaa $\n\n" )
306 makefile.write(
"PACKAGE = %s\n" % name )
307 makefile.write(
"PACKAGE_PRELOAD = Tree\n" )
308 makefile.write(
"# Add the option -DACTIVATE_BRANCHES if your analysis framework\n" )
309 makefile.write(
"# disables all branches by default.\n" )
310 makefile.write(
"# Remove the COLLECT_D3PD_READING_STATISTICS option to gain a bit\n" )
311 makefile.write(
"# of performance...\n" )
312 makefile.write(
"PACKAGE_CXXFLAGS = -DCOLLECT_D3PD_READING_STATISTICS\n" )
313 makefile.write(
"PACKAGE_LDFLAGS =\n" )
314 makefile.write(
"PACKAGE_DEP =\n" )
315 makefile.write(
"PACKAGE_PEDANTIC = 1\n" )
316 makefile.write(
"PACKAGE_NOOPT = dict\n\n" )
317 makefile.write(
"include $(ROOTCOREDIR)/Makefile-common\n" )
321 requirements =
open( directory +
"/" + name +
"/cmt/requirements",
"w" )
322 requirements.write(
"package %s\n\n" % name )
323 requirements.write(
"use AtlasPolicy AtlasPolicy-*\n" )
324 requirements.write(
"use AtlasROOT AtlasROOT-* External\n\n" )
325 requirements.write(
"library %s ../Root/*.cxx\n" % name )
326 requirements.write(
"apply_pattern installed_library\n\n" )
327 requirements.write(
"apply_pattern have_root_headers root_headers=\"*.h " \
328 "../Root/LinkDef.h\" headers_lib=%s\n" % name )
348 from AthenaCommon.Logging
import logging
349 logger = logging.getLogger(
"makeSFramePackageSkeleton" )
353 if not os.path.exists( directory ):
354 logger.error(
"The output directory (%s) doesn't exist!", directory )
358 if os.path.exists( directory +
"/" + name ):
359 logger.error(
"The directory for the package (%s/%s) already exists!", directory, name )
364 os.mkdir( directory +
"/" + name, 0o755 )
365 os.mkdir( directory +
"/" + name +
"/include", 0o755 )
366 os.mkdir( directory +
"/" + name +
"/src", 0o755 )
367 os.mkdir( directory +
"/" + name +
"/proof", 0o755 )
370 makefile =
open( directory +
"/" + name +
"/Makefile",
"w" )
371 makefile.write(
"# $Id: Helpers.py 600807 2014-06-08 15:26:51Z krasznaa $\n\n" )
372 makefile.write(
"# Package information\n" )
373 makefile.write(
"LIBRARY = %s\n" % name )
374 makefile.write(
"OBJDIR = obj\n" )
375 makefile.write(
"DEPDIR = $(OBJDIR)/dep\n" )
376 makefile.write(
"SRCDIR = src\n" )
377 makefile.write(
"INCDIR = include\n\n" )
378 makefile.write(
"# Enable collecting D3PD reading statistics\n" )
379 makefile.write(
"INCLUDES += -DCOLLECT_D3PD_READING_STATISTICS\n\n" )
380 makefile.write(
"# Include the generic compilation rules\n" )
381 makefile.write(
"include $(SFRAME_DIR)/Makefile.common\n" )
385 setup =
open( directory +
"/" + name +
"/proof/SETUP.C",
"w" )
386 setup.write(
"// $Id: Helpers.py 600807 2014-06-08 15:26:51Z krasznaa $\n\n" )
387 setup.write(
"int SETUP() {\n\n" )
388 setup.write(
" if( gSystem->Load( \"libTree\" ) == -1 ) return -1;\n" )
389 setup.write(
" if( gSystem->Load( \"lib%s\" ) == -1 ) return -1;\n\n" % name )
390 setup.write(
" return 0;\n" )
394 build =
open( directory +
"/" + name +
"/proof/BUILD.sh",
"w" )
395 build.write(
"# $Id: Helpers.py 600807 2014-06-08 15:26:51Z krasznaa $\n\n" )
396 build.write(
"if [ \"$1\" = \"clean\" ]; then\n" )
397 build.write(
" make distclean\n" )
398 build.write(
" exit 0\n" )
399 build.write(
"fi\n\n" )
400 build.write(
"make default\n" )
402 os.chmod( directory +
"/" + name +
"/proof/BUILD.sh", 0o755 )