216 po::options_description
generic(
"Generic options");
217 generic.add_options()
219 "produce this help message")
222 "name of the package for which we create the configurables file")
223 (
"input-libraries,i",
225 "libraries to extract the component configurables from")
228 "path to the cfg file holding the description of the Configurable base "
229 "classes, the python module holding the Configurable definitions, etc...")
231 po::value<string>()->default_value(
"../genConf"),
232 "output directory for genconf files.")
234 po::value<int>()->default_value(0),
237 po::value< Strings_t >()->composing(),
238 "preloading library")
241 "user-defined module to be imported by the genConf-generated one")
243 "do not generate the (empty) __init__.py")
248 po::options_description
config(
"Configuration");
250 (
"configurable-module",
251 po::value<string>()->default_value(
"AthenaCommon"),
252 "Name of the module holding the configurable classes")
253 (
"configurable-default-name",
254 po::value<string>()->default_value(
"Configurable.DefaultName"),
255 "Default name for the configurable instance")
256 (
"configurable-algorithm",
257 po::value<string>()->default_value(
"ConfigurableAlgorithm"),
258 "Name of the configurable base class for Algorithm components")
259 (
"configurable-algtool",
260 po::value<string>()->default_value(
"ConfigurableAlgTool"),
261 "Name of the configurable base class for AlgTool components")
262 (
"configurable-auditor",
263 po::value<string>()->default_value(
"ConfigurableAuditor"),
264 "Name of the configurable base class for Auditor components")
265 (
"configurable-service",
266 po::value<string>()->default_value(
"ConfigurableService"),
267 "Name of the configurable base class for Service components")
270 po::options_description cmdline_options;
271 cmdline_options.add(
generic).add(
config);
273 po::options_description config_file_options;
274 config_file_options.add(
config);
276 po::options_description visible(
"Allowed options");
277 visible.add(
generic).add(
config);
279 po::variables_map vm;
282 po::store( po::command_line_parser(
argc,
argv).
283 options(cmdline_options).run(),
289 if( vm.count(
"input-cfg") ) {
290 string cfgFileName = vm[
"input-cfg"].as<
string>();
291 cfgFileName = fs::system_complete(
fs::path( cfgFileName ) ).
string();
293 po::store( parse_config_file( ifs, config_file_options ), vm );
298 catch ( po::error& err ) {
299 cout <<
"ERROR: error detected while parsing command options: "<< err.what() <<
endl;
304 if( vm.count(
"help")) {
309 if( vm.count(
"package-name") ) {
310 pkgName = vm[
"package-name"].as<
string>();
313 cout <<
"ERROR: 'package-name' required" <<
endl;
314 cout << visible << endl;
318 if( vm.count(
"user-module") ) {
319 userModule = vm[
"user-module"].as<
string>();
320 cout <<
"INFO: will import user module " << userModule <<
endl;
323 if( vm.count(
"input-libraries") ) {
329 string tmp = vm[
"input-libraries"].as<
string>();
331 boost::split( inputLibs, tmp,
332 boost::is_any_of(
" "),
333 boost::token_compress_on );
338 for ( Strings_t::const_iterator iLib = inputLibs.
begin();
339 iLib != inputLibs.
end();
342 if ( 0 == lib.
find(
"lib") ) {
351 if ( libs.
empty() ) {
352 cout <<
"ERROR: input component library(ies) required !\n"
353 <<
"ERROR: 'input-libraries' argument was ["
354 << vm[
"input-libraries"].as<
string>()
361 cout <<
"ERROR: input component library(ies) required" <<
endl;
362 cout << visible << endl;
366 if( vm.count(
"output-dir") ) {
367 out = fs::system_complete(
fs::path( vm[
"output-dir"].as<string>() ) );
370 if ( vm.count(
"debug-level") ) {
374 if ( vm.count(
"load-library") ) {
376 for (Strings_t::const_iterator lLib=lLib_list.
begin();
377 lLib != lLib_list.
end();
383 cout <<
"WARNING: failed to load: "<< *lLib <<
endl;
389 if ( !fs::exists( out ) ) {
391 fs::create_directory(out);
393 catch ( fs::filesystem_error &err ) {
394 cout <<
"ERROR: error creating directory: "<< err.what() <<
endl;
399 cout <<
":::::: libraries : [ ";
405 py.setConfigurableDefaultName(vm[
"configurable-default-name"].as<string>());
406 py.setConfigurableAlgorithm (vm[
"configurable-algorithm"].as<string>());
407 py.setConfigurableAlgTool (vm[
"configurable-algtool"].as<string>());
408 py.setConfigurableAuditor (vm[
"configurable-auditor"].as<string>());
409 py.setConfigurableService (vm[
"configurable-service"].as<string>());
411 int sc = EXIT_FAILURE;
413 sc = py.genConfig( libs, userModule );
416 cout <<
"ERROR: Could not generate Configurable(s) !\n"
417 <<
"ERROR: Got exception: " << e.
what() << endl;
421 if ( EXIT_SUCCESS == sc && ! vm.count(
"no-init")) {
424 std::ios_base::out|std::ios_base::trunc );
425 initPy <<
"## Hook for " << pkgName <<
" genConf module\n" <<
flush;
428 cout <<
":::::: libraries : [ ";
430 cout <<
"] :::::: [DONE]" << endl;
void * ImageHandle
Definition of an image handle.
void setConfigurableModule(const std::string &moduleName)
customize the Module name where configurable base classes are defined
GAUDIPS_API void SetDebug(int debugLevel)
Backward compatibility with Reflex.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.