]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[bos #32522][EDF] SALOME on Demand. Added set SALOME_APPLICATION_DIR env, queryinstal...
authorKonstantin Leontev <konstantin.leontev@opencascade.com>
Fri, 30 Dec 2022 17:08:05 +0000 (20:08 +0300)
committerKonstantin LEONTEV <konstantin.leontev@opencascade.com>
Wed, 8 Mar 2023 12:46:28 +0000 (13:46 +0100)
bin/SalomeOnDemandTK/extension_query.py
bin/SalomeOnDemandTK/extension_utilities.py
bin/runSalomeOnDemand.py

index 600a9d30a3b95a80ddfb2c1375cfc8c122bccf08..dbcea88ee5b3277a240843569cc87cb49c539245 100644 (file)
@@ -260,6 +260,33 @@ def dependency_tree(directory):
     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])
index f60c80efd3754a90f6337bd937fe45046b3ca50e..ae2dc6ccb2e99a64738c3acf5fcfe6ef6773f983 100644 (file)
@@ -37,6 +37,10 @@ import logging
 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__'
index 47351851b878050f2bb84b9fe5a4362796073995..69d48b00fffb2e64eacba4136f0dafb9abbbc5f1 100755 (executable)
@@ -98,8 +98,11 @@ def set_ext_env(app_name='', version=''):
         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)