138 logger = logging.getLogger( os.path.splitext( os.path.basename( sys.argv[ 0 ] ) )[ 0 ] )
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 " \
146 vers =
"$Revision: 600807 $"
147 parser = optparse.OptionParser( description = desc,
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" )
167 ( options, files ) = parser.parse_args()
171 logger.error(
"You have to define at least one source file!" )
176 logging.getLogger(
"" ).
setLevel( options.verbosity )
179 logger.info(
"***********************************************************" )
180 logger.info(
"* D3PDReader Library Maker" )
181 logger.info(
"* Version: $Revision: 600807 $" )
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(
"***********************************************************" )
196 makefile =
open( options.output +
"/" + options.makefile,
"w" )
198 logger.error(
"Couldn't open " + options.output +
"/" + options.makefile +
" for writing!" )
201 logger.info(
"Writing makefile to: " + options.output +
"/" + options.makefile )
205 makefile.write( makefile_template % ( options.libname, options.linkdef,
206 " ".
join( header_files ),
207 " ".
join( source_files ) ) )
212 logger.debug(
"The class names found: " +
", ".
join( classnames ) )
217 logger.error(
"Failed writing the LinkDef file!" )