logger.debug('Try to read %s.%s file...', salome_ext_name, DFILE_EXT)
salomexd_mem = ext.getmember(salome_ext_name + '.' + DFILE_EXT)
salomexd_file = ext.extractfile(salomexd_mem)
+ if not salomexd_file:
+ logger.error('Cannot extract %s.%s file!', salome_ext_name, DFILE_EXT)
+ return False
+
salomexd_content = json.load(salomexd_file)
logger.debug('Check dependencies...')
# Usually logging verbosity is set inside bin/runSalomeCommon.py when salome is starting.
# Here we do just the same for a case if we call this package stand alone.
FORMAT = '%(levelname)s : %(asctime)s : [%(filename)s:%(funcName)s:%(lineno)s] : %(message)s'
-logging.basicConfig(format=FORMAT, level=logging.DEBUG, force=False)
+logging.basicConfig(format=FORMAT, level=logging.DEBUG)
logger = logging.getLogger()
# SalomeContext sets the logging verbosity level on its own,
sys.modules[module_name] = module
logger.debug('Execute %s module', module_name)
+ if not spec.loader:
+ logger.error('spec.loader is None for %s file!')
+ return None
+
spec.loader.exec_module(module)
return module
# Set the root dir as env variable
if not context:
- context = salomeContext.SalomeContext(None)
+ context = salomeContext.SalomeContext(0)
context.setVariable('SALOME_APPLICATION_DIR', install_dir, overwrite=False)
# Find env file
# Setting formatter in setVerbose() was commented because adding of handler
# breaks using of root logger in other modules and cause many double lines in logs.
FORMAT = '%(levelname)s : %(asctime)s : [%(filename)s:%(funcName)s:%(lineno)s] : %(message)s'
-logging.basicConfig(format=FORMAT, force=True)
+logging.basicConfig(format=FORMAT)
logger = logging.getLogger()
class ColoredFormatter(logging.Formatter):
return
# Set the root dir as env variable
- context = salomeContext.SalomeContext(None)
+ context = salomeContext.SalomeContext(0)
context.setVariable('SALOME_APPLICATION_DIR', app_root, overwrite=True)
# Execute env file as a module