Salome HOME
petit correctif suite à discussion
authorcrouzet <nicolas.crouzet@cea.fr>
Tue, 16 Jul 2019 13:39:18 +0000 (15:39 +0200)
committercrouzet <nicolas.crouzet@cea.fr>
Tue, 16 Jul 2019 13:39:18 +0000 (15:39 +0200)
src/compilation.py
src/environment.py
src/fileEnviron.py

index 7eb5071943383b9dbbbf625ccb8cdf8c81394109..b8b8ce0cf8150b24ff76340da35da6ebbb019baf 100644 (file)
@@ -284,7 +284,7 @@ CC=\\"hack_libtool\\"%g" libtool'''
     ##
     # Runs 'make install'.
     def install(self):
-        if self.config.VARS.dist_name==distrib_cfg.DISTRIBUTIONS["Windows"]:
+        if src.architecture.is_windows():
             command = 'msbuild INSTALL.vcxproj'
             if self.debug_mode:
                 command = command + " /p:Configuration=Debug  /p:Platform=x64 "
index ae27354a8767b79918c540adab38f0f4abaf6b9c..08565ce752ec4004fe10c411278e0fb9aee0d578 100644 (file)
@@ -73,18 +73,11 @@ class Environ:
         :param value str: the value to append to key
         :param sep str: the separator string
         """
-        if src.architecture.is_windows():
-          separators = [';']
-        else:
-          separators = [':']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("Environ append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("Environ append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         # check if the key is already in the environment
         if key in self.environ:
             value_list = self.environ[key].split(sep)
@@ -120,18 +113,11 @@ class Environ:
         :param value str: the value to prepend to key
         :param sep str: the separator string
         """
-        if src.architecture.is_windows():
-          separators = [';']
-        else:
-          separators = [':']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("Environ prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("Environ append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         # check if the key is already in the environment
         if key in self.environ:
             value_list = self.environ[key].split(sep)
index 851b7c9ed27ba8aa4f69a615dcda37bba973c864..8061c44766199eb19e6ffd051b687d1a34107175 100644 (file)
@@ -181,19 +181,11 @@ class FileEnviron(object):
         :param value str: the value to append to key
         :param sep str: the separator string
         """
-        separators = []
-        if src.architecture.is_windows(): 
-          separators = [':']
-        else:
-          separators = [';']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("FileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("FileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         self.set(key, self.get(key) + sep + value)
         if (key, sep) not in self.toclean:
             self.toclean.append((key, sep))
@@ -221,19 +213,11 @@ class FileEnviron(object):
         :param value str: the value to prepend to key
         :param sep str: the separator string
         """
-        separators = []
-        if src.architecture.is_windows(): 
-          separators = [':']
-        else:
-          separators = [';']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("FileEnviron prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("FileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         self.set(key, value + sep + self.get(key))
         if (key, sep) not in self.toclean:
             self.toclean.append((key, sep))
@@ -576,19 +560,11 @@ class LauncherFileEnviron:
         :param value str: the value to append to key
         :param sep str: the separator string
         """
-        separators = []
-        if src.architecture.is_windows(): 
-          separators = [':']
-        else:
-          separators = [';']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("LauncherFileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("LauncherFileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         if self.is_defined(key) :
             self.add(key, value)
         else :
@@ -615,19 +591,11 @@ class LauncherFileEnviron:
         :param value str: the value to prepend to key
         :param sep str: the separator string
         """
-        separators = []
-        if src.architecture.is_windows(): 
-          separators = [':']
-        else:
-          separators = [';']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("LauncherFileEnviron prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("LauncherFileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         if self.is_defined(key) :
             self.add(key, value)
         else :