Salome HOME
Replace a fix by another fix ...
[modules/kernel.git] / src / KERNEL_PY / salome_test.py
index 23d7d4a1adcdac429cdf8697debc4b0e299c2bc9..e0aab705cce2336892cd08f7a445289baa2e25ea 100755 (executable)
@@ -253,14 +253,16 @@ print ret
 smesh.Compute(mesh, box)
 sg.updateObjBrowser(1);
 
+#####################################################################
 # SUPERVISOR module is not available since SALOME 5.0 version
-defineSuperV = 0
-
-if (defineSuperV != 0) & (sys.platform != "win32"):
-       print
-       print "=============  Test      Supervisor      ============================="
-       print
-
+#####################################################################
+print
+print "=============  Test     Supervisor      ============================="
+print
+import salome_version
+versions = salome_version.getVersions()
+if versions[0] < 5:
+       # SUPERV module is avaiable
        comp = catalog.GetComponent("SUPERV")
        if comp is None:
                raise RuntimeError,"Component SUPERV not found in Module Catalog."
@@ -455,6 +457,10 @@ if (defineSuperV != 0) & (sys.platform != "win32"):
        sg.updateObjBrowser(1);
 
        pass
+else:
+       # SUPERV module is NOT avaiable
+       print "WARNING! Supervisor is not avaiable in this version of SALOME!"
+       pass
 
 print
 print "=============  Test  VISU  and MED ============================="
@@ -473,7 +479,11 @@ import VISU
 import visu_gui
 
 medFileName = "pointe.med"
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
+if sys.platform != "win32":
+    medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
+else:
+    medFile = os.getenv('DATA_DIR') + '\\MedFiles\\' + medFileName
+    pass
 print "Load ", medFile
 
 studyCurrent = salome.myStudyName
@@ -488,7 +498,7 @@ try:
                if sys.platform != "win32":
                  tmpDir = "/tmp/"
                else:
-                 tmpDir = os.getenv('TEMP') + '/'
+                 tmpDir = os.getenv('TEMP') + '\\'
               medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName
               print " -- Copy " + medFile + " to " + medFileNew
 
@@ -499,7 +509,9 @@ try:
               os.system(copyCommand + " " + medFile + " " + medFileNew)
 
               medFile = medFileNew
-              os.system("chmod 755 " + medFile)
+              if sys.platform != "win32":
+                  os.system("chmod 755 " + medFile)
+                  pass
 
        if os.access(medFile, os.W_OK) :
            med_comp.readStructFileWithFieldType(medFile,studyCurrent)