ATLAS Offline Software
Functions | Variables
d3pdReaderLibraryMaker Namespace Reference

Functions

def main ()
 

Variables

 makefile_template = \
 

Function Documentation

◆ main()

def d3pdReaderLibraryMaker.main ( )

Definition at line 136 of file d3pdReaderLibraryMaker.py.

136 def main():
137  # Create a logger object first of all:
138  logger = logging.getLogger( os.path.splitext( os.path.basename( sys.argv[ 0 ] ) )[ 0 ] )
139 
140  #
141  # Specify the command line options:
142  #
143  desc = "This script can be used to generate a LinkDef.h header and a Makefile " \
144  "to compile some D3PDReader source files into a standalone (shared and " \
145  "static) library."
146  vers = "$Revision: 600807 $"
147  parser = optparse.OptionParser( description = desc,
148  version = vers,
149  usage = "%prog [options] <source files>" )
150  parser.add_option( "-v", "--verbosity", dest = "verbosity",
151  action = "store", type = "int", default = 3,
152  help = "Message verbosity level" )
153  parser.add_option( "-o", "--output", dest = "output",
154  action = "store", type = "string", default = "./",
155  help = "Output directory for the generated files" )
156  parser.add_option( "-m", "--makefile", dest = "makefile",
157  action = "store", type = "string", default = "Makefile",
158  help = "File name for the generated makefile" )
159  parser.add_option( "-l", "--linkdef", dest = "linkdef",
160  action = "store", type = "string", default = "LinkDef.h",
161  help = "File name for the generated linkdef header" )
162  parser.add_option( "-n", "--libname", dest = "libname",
163  action = "store", type = "string", default = "D3PDReader",
164  help = "Name of the library to be compiled" )
165 
166  # Parse the command line options:
167  ( options, files ) = parser.parse_args()
168 
169  # Do a small sanity check:
170  if not len( files ):
171  logger.error( "You have to define at least one source file!" )
172  parser.print_help()
173  return 255
174 
175  # Set the default logging level:
176  logging.getLogger( "" ).setLevel( options.verbosity )
177 
178  # Print some welcome message:
179  logger.info( "***********************************************************" )
180  logger.info( "* D3PDReader Library Maker" )
181  logger.info( "* Version: $Revision: 600807 $" )
182  logger.info( "*" )
183  logger.info( "* Output level: " + str( options.verbosity ) )
184  logger.info( "* Output directory: " + options.output )
185  logger.info( "* Makefile name: " + options.makefile )
186  logger.info( "* LinkDef name: " + options.linkdef )
187  logger.info( "* Library name: " + options.libname )
188  logger.info( "* Source files: " + ", ".join( files ) )
189  logger.info( "***********************************************************" )
190 
191  # Filter out the header and source files:
192  ( dummy_header_files, source_files ) = separateSources( files )
193  header_files = dictionaryHeaders( files )
194 
195  # Open the makefile:
196  makefile = open( options.output + "/" + options.makefile, "w" )
197  if not makefile:
198  logger.error( "Couldn't open " + options.output + "/" + options.makefile + " for writing!" )
199  return 255
200  else:
201  logger.info( "Writing makefile to: " + options.output + "/" + options.makefile )
202  pass
203 
204  # Write the makefile's contents:
205  makefile.write( makefile_template % ( options.libname, options.linkdef,
206  " ".join( header_files ),
207  " ".join( source_files ) ) )
208  makefile.close()
209 
210  # Extract the class names from the header files:
211  classnames = dictionaryClasses( header_files )
212  logger.debug( "The class names found: " + ", ".join( classnames ) )
213 
214  # Write the LinkDef file:
215  if writeLinkDefFile( options.output + "/" + options.linkdef,
216  classnames ):
217  logger.error( "Failed writing the LinkDef file!" )
218  return 255
219 
220  return 0
221 

Variable Documentation

◆ makefile_template

d3pdReaderLibraryMaker.makefile_template = \

Definition at line 24 of file d3pdReaderLibraryMaker.py.

pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
python.Helpers.separateSources
def separateSources(filenames)
Separate the source and header files based on their names.
Definition: PhysicsAnalysis/D3PDMaker/D3PDMakerReader/python/Helpers.py:17
python.Helpers.dictionaryClasses
def dictionaryClasses(filenames)
Function collecting the class names to create a dictionary for.
Definition: PhysicsAnalysis/D3PDMaker/D3PDMakerReader/python/Helpers.py:80
python.Helpers.writeLinkDefFile
def writeLinkDefFile(filename, classnames, headers=[])
Function writing a LinkDef file.
Definition: PhysicsAnalysis/D3PDMaker/D3PDMakerReader/python/Helpers.py:172
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11
d3pdReaderLibraryMaker.main
def main()
Definition: d3pdReaderLibraryMaker.py:136
python.Helpers.dictionaryHeaders
def dictionaryHeaders(filenames)
Find the headers needed for dictionary generation.
Definition: PhysicsAnalysis/D3PDMaker/D3PDMakerReader/python/Helpers.py:48