return tree
+def ext_info_dict(directory):
+ r"""
+ Get installed salome extensions info.
+
+ Args:
+ directory - the given ext install directory.
+
+ Returns:
+ A dictionary {name: size}.
+ """
+
+ logger.debug('Build info dictionary for extensions in %s', directory)
+
+ ext_info = {}
+ salomexd_files = list_files_ext(directory, DFILE_EXT)
+ logger.debug('There are %s extensions in %s', len(salomexd_files), directory)
+
+ for salomexd_file in salomexd_files:
+ ext_name, _ = os.path.splitext(os.path.basename(salomexd_file))
+ size = ext_size_str(directory, ext_name)
+
+ ext_info[ext_name] = size
+
+ logger.debug('Installed extensions info: %s', ext_info)
+ return ext_info
+
+
if __name__ == '__main__':
if len(sys.argv) == 2:
dir_size_str(sys.argv[1])
import json
from traceback import format_exc
+# 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)
logger = logging.getLogger()
SALOME_EXTDIR = '__SALOME_EXT__'
logger.debug('There are not any extensions in %s!', app_root)
return
- # Execute env file as a module
+ # Set the root dir as env variable
context = salomeContext.SalomeContext(None)
+ context.setVariable('SALOME_APPLICATION_DIR', app_root, overwrite=True)
+
+ # Execute env file as a module
ext_root = os.path.join(app_root, SALOME_EXTDIR)
for salomexd in installed_ext:
salomexd_name = os.path.basename(salomexd)