Salome HOME
Merged from BR_V51_RB (removed Batch and added libBatch as an optional prerequisite).
[modules/kernel.git] / src / KERNEL_PY / salome_test.py
index d18c706e2d0411fb74b701af2797095f144cbb43..e0aab705cce2336892cd08f7a445289baa2e25ea 100755 (executable)
@@ -1,12 +1,28 @@
-#  SALOME SALOME_SWIG : binding of C++ implementation and Python
+#  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 #
-#  Copyright (C) 2003  CEA/DEN, EDF R&D
-#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
 #
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
 #
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+#  SALOME SALOME_SWIG : binding of C++ implementation and Python
 #  File   : salome_test.py
 #  Module : SALOME
-
+#
 print "Test the application loading  GEOM, SMESH, VISU, MED, components and doing some"
 print "operation within the components."
 
@@ -237,11 +253,16 @@ print ret
 smesh.Compute(mesh, box)
 sg.updateObjBrowser(1);
 
-if sys.platform        != "win32":
-       print
-       print "=============  Test      Supervisor      ============================="
-       print
-
+#####################################################################
+# SUPERVISOR module is not available since SALOME 5.0 version
+#####################################################################
+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."
@@ -436,6 +457,10 @@ if 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 ============================="
@@ -454,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
@@ -469,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
 
@@ -480,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)