216                     ? boost::log::trivial::info
   217                     : boost::log::trivial::warning );
   226   po::options_description 
generic( 
"Generic options" );
   227   generic.add_options()( 
"help,h", 
"produce this help message" )(
   228       "package-name,p", po::value<string>(), 
"name of the package for which we create the configurables file" )(
   229       "input-libraries,i", po::value<string>(), 
"libraries to extract the component configurables from" )(
   230       "input-cfg,c", po::value<string>(), 
"path to the cfg file holding the description of the Configurable base "   231                                           "classes, the python module holding the Configurable definitions, etc..." )(
   232       "output-dir,o", po::value<string>()->default_value( 
"../genConf" ),
   233       "output directory for genconf files." )( 
"debug-level,d", po::value<int>()->default_value( 0 ), 
"debug level" )(
   234       "load-library,l", po::value<Strings_t>()->composing(), 
"preloading library" )(
   235       "user-module,m", po::value<string>(), 
"user-defined module to be imported by the genConf-generated one" )(
   236       "no-init", 
"do not generate the (empty) __init__.py" );
   240   po::options_description 
config( 
"Configuration" );
   241   config.add_options()( 
"configurable-module", po::value<string>()->default_value( 
"AthenaCommon" ),
   242                         "Name of the module holding the configurable classes" )(
   243       "configurable-default-name", po::value<string>()->default_value( 
"Configurable.DefaultName" ),
   244       "Default name for the configurable instance" )( 
"configurable-algorithm",
   245                                                       po::value<string>()->default_value( 
"ConfigurableAlgorithm" ),
   246                                                       "Name of the configurable base class for Algorithm components" )(
   247       "configurable-algtool", po::value<string>()->default_value( 
"ConfigurableAlgTool" ),
   248       "Name of the configurable base class for AlgTool components" )(
   249       "configurable-auditor", po::value<string>()->default_value( 
"ConfigurableAuditor" ),
   250       "Name of the configurable base class for Auditor components" )(
   251       "configurable-service", po::value<string>()->default_value( 
"ConfigurableService" ),
   252       "Name of the configurable base class for Service components" );
   254   po::options_description cmdline_options;
   255   cmdline_options.add( 
generic ).add( 
config );
   257   po::options_description config_file_options;
   258   config_file_options.add( 
config );
   260   po::options_description visible( 
"Allowed options" );
   261   visible.add( 
generic ).add( 
config );
   263   po::variables_map vm;
   266     po::store( po::command_line_parser( 
argc, 
argv ).
options( cmdline_options ).run(), vm );
   271     if ( vm.count( 
"input-cfg" ) ) {
   272       string cfgFileName = vm[
"input-cfg"].as<
string>();
   273       cfgFileName        = fs::system_complete( 
fs::path( cfgFileName ) ).
string();
   275       po::store( parse_config_file( ifs, config_file_options ), vm );
   279   } 
catch ( po::error& err ) {
   280     LOG_ERROR << 
"error detected while parsing command options: " << err.what();
   285   if ( vm.count( 
"help" ) ) {
   290   if ( vm.count( 
"package-name" ) ) {
   291     pkgName = vm[
"package-name"].as<
string>();
   298   if ( vm.count( 
"user-module" ) ) {
   299     userModule = vm[
"user-module"].as<
string>();
   300     LOG_INFO << 
"INFO: will import user module " << userModule;
   303   if ( vm.count( 
"input-libraries" ) ) {
   309       string tmp = vm[
"input-libraries"].as<
string>();
   311       boost::split( inputLibs, tmp, boost::is_any_of( 
" " ), boost::token_compress_on );
   316     for ( Strings_t::const_iterator iLib = inputLibs.
begin(); iLib != inputLibs.
end(); ++iLib ) {
   318       if ( 0 == lib.
find( 
"lib" ) ) {
   326     if ( libs.
empty() ) {
   327       LOG_ERROR << 
"input component library(ies) required !\n";
   328       LOG_ERROR << 
"'input-libraries' argument was [" << vm[
"input-libraries"].as<
string>() << 
"]";
   332     LOG_ERROR << 
"input component library(ies) required";
   337   if ( vm.count( 
"output-dir" ) ) {
   338     out = fs::system_complete( 
fs::path( vm[
"output-dir"].as<string>() ) );
   341   if ( vm.count( 
"debug-level" ) ) {
   345   if ( vm.count( 
"load-library" ) ) {
   347     for ( Strings_t::const_iterator lLib = lLib_list.
begin(); lLib != lLib_list.
end(); ++lLib ) {
   357   if ( !fs::exists( out ) ) {
   359       fs::create_directory( out );
   360     } 
catch ( fs::filesystem_error& err ) {
   361       LOG_ERROR << 
"error creating directory: " << err.what();
   368     msg << 
":::::: libraries : [ ";
   376   py.setConfigurableDefaultName( vm[
"configurable-default-name"].as<string>() );
   377   py.setConfigurableAlgorithm( vm[
"configurable-algorithm"].as<string>() );
   378   py.setConfigurableAlgTool( vm[
"configurable-algtool"].as<string>() );
   379   py.setConfigurableAuditor( vm[
"configurable-auditor"].as<string>() );
   380   py.setConfigurableService( vm[
"configurable-service"].as<string>() );
   382   int sc = EXIT_FAILURE;
   384     sc = py.genConfig( libs, userModule );
   386     cout << 
"ERROR: Could not generate Configurable(s) !\n"   387          << 
"ERROR: Got exception: " << e.
what() << 
endl;
   391   if ( EXIT_SUCCESS == sc && !vm.count( 
"no-init" ) ) {
   393     fstream initPy( ( out / 
fs::path( 
"__init__.py" ) ).
string(), std::ios_base::out | std::ios_base::trunc );
   394     initPy << 
"## Hook for " << pkgName << 
" genConf module\n" << 
flush;
   399     msg << 
":::::: libraries : [ ";
   401     msg << 
"] :::::: [DONE]";
 GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set) 
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 bool isEnvSet(const char *var)
Check if an environment variable is set or not. 
void init_logging(boost::log::trivial::severity_level level)
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.