Salome HOME
add get_value method to Environ classes, to conform with the API of FileEnviron
authorcrouzet <nicolas.crouzet@cea.fr>
Thu, 17 Jan 2019 13:46:56 +0000 (14:46 +0100)
committercrouzet <nicolas.crouzet@cea.fr>
Thu, 17 Jan 2019 13:46:56 +0000 (14:46 +0100)
commands/config.py
src/environment.py
src/fileEnviron.py

index c83aecf5691f86493111711878ad89cad887ecaf..b66f8e42c4c2e64b838da5c1e104f00155cf9036 100644 (file)
@@ -722,6 +722,7 @@ def show_product_info(config, name, logger):
                                     check_path(pinfo.environ.env_script), 
                                     2)
 
+    # display run-time environment
     zz = src.environment.SalomeEnviron(config,
                                        src.fileEnviron.ScreenEnviron(logger), 
                                        False)
index df6db679535691fffc7aee874bd5ac6ebe24bfab..283251972fa4f353a13658848f42a1459ebef712 100644 (file)
@@ -167,6 +167,15 @@ class Environ:
         else:
             return ""
 
+    def get_value(self, key):
+        """\
+        Get the value of the environment variable "key"
+        This method is added for API compatibility with FileEnviron class
+        
+        :param key str: the environment variable
+        """
+        return self.get(key)
+
     def command_value(self, key, command):
         """\
         Get the value given by the system command "command" 
@@ -255,6 +264,18 @@ class SalomeEnviron:
         """
         return self.environ.get(key)
 
+    def get_value(self, key):
+        """\
+        Get the real value of the environment variable "key"
+        This method is added for API compatibility with FileEnviron class
+        
+        :param key str: the environment variable
+        """
+        if key in self.environ:
+            return self.environ[key]
+        else:
+            return ""
+
     def set(self, key, value):
         """\
         Set the environment variable "key" to value "value"
@@ -673,7 +694,7 @@ class SalomeEnviron:
                                             product_info.install_dir,
                                             product_info.version)
                 else:
-                    # at least this one is mandatoryi,
+                    # at least this one is mandatory,
                     # if set_env_build and set_env_build are not defined
                     pyproduct.set_env(self,
                                       product_info.install_dir,
index 0e4036761c5477109da8e49f1b1f2e8252b4b258..fa45497f9f8dc1271015ae9c3de0cff712d325ae 100644 (file)
@@ -636,7 +636,7 @@ class LauncherFileEnviron:
         self.environ[key] = value
     
     def get_value(self, key):
-        """Get the real value of the environment variable "key"
+        """Get the real value of the environment variable "key", not ${key}
         It can help env scripts
         :param key str: the environment variable
         """