From 436504b67380d6a4528ef253a4b7b5cff4b1b6ed Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 31 Aug 2018 10:56:05 +0300 Subject: [PATCH] Rename MEDCoupling to MEDCouplingCompat under Windows. --- doc/user/images/cartesian.py | 6 +++++- doc/user/images/convert2quadratic.py | 7 +++++-- doc/user/images/curvelinear.py | 6 +++++- doc/user/images/explodeIntoEdges.py | 7 +++++-- doc/user/images/extractSlice3D.py | 7 ++++++- doc/user/images/extract_mesh_fetched_nodes.py | 5 ++++- doc/user/images/extract_mesh_ids.py | 6 ++++-- doc/user/images/extrusion.py | 7 +++++-- doc/user/images/intersect_2d1d.py | 6 ++++-- doc/user/images/intersect_2d2d.py | 6 ++++-- doc/user/images/measure_field.py | 7 ++++++- doc/user/images/orderConsecutiveCells1D.py | 5 ++++- doc/user/images/orient_2d.py | 6 ++++-- doc/user/images/ortho_field.py | 6 +++++- doc/user/images/partition.py | 6 ++++-- doc/user/images/partition_with_layer.py | 6 ++++-- doc/user/images/projection_P0P1_dual.py | 7 +++++-- doc/user/images/projection_P0P1_meshes.py | 7 +++++-- doc/user/images/projection_P1P0_dual.py | 7 +++++-- doc/user/images/renumber_nodes.py | 6 ++++-- doc/user/images/simplexize.py | 8 +++++--- doc/user/images/skin.py | 6 +++++- doc/user/images/zones.py | 7 ++++++- src/MEDCoupling_Swig/CMakeLists.txt | 19 +++++++++++++------ .../MEDCouplingBasicsTest1.py | 7 ++++++- .../MEDCouplingBasicsTest2.py | 7 ++++++- .../MEDCouplingBasicsTest3.py | 6 +++++- .../MEDCouplingBasicsTest4.py | 7 ++++++- .../MEDCouplingBasicsTest5.py | 8 +++++++- .../MEDCouplingBasicsTest6.py | 7 ++++++- .../MEDCouplingDataForTest.py | 7 ++++++- .../MEDCouplingExamplesTest.py | 7 ++++++- .../MEDCouplingIntersectTest.py | 7 ++++++- src/MEDCoupling_Swig/MEDCouplingNumPyTest.py | 7 ++++++- src/MEDCoupling_Swig/MEDCouplingPickleTest.py | 7 ++++++- .../UsersGuideExamplesTest.py | 7 ++++++- .../UsersGuideExamplesTest_numpy.py | 12 ++++++++++-- src/PyWrapping/CMakeLists.txt | 12 ++++++------ src/RENUMBER_Swig/MEDRenumberTest.py | 7 ++++++- src/RENUMBER_Swig/UsersGuideExamplesTest.py | 14 +++++++++++--- 40 files changed, 227 insertions(+), 68 deletions(-) diff --git a/doc/user/images/cartesian.py b/doc/user/images/cartesian.py index 7ac1c79d0..2829dfb63 100644 --- a/doc/user/images/cartesian.py +++ b/doc/user/images/cartesian.py @@ -64,8 +64,12 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * -from MEDCoupling import * from MEDLoader import WriteMesh XCoords=[-0.3,0.,0.1,0.3,0.45,0.47,0.49,1.,1.22] # 9 values along X diff --git a/doc/user/images/convert2quadratic.py b/doc/user/images/convert2quadratic.py index d4cb1d08f..7bb05d062 100644 --- a/doc/user/images/convert2quadratic.py +++ b/doc/user/images/convert2quadratic.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDLoader import WriteMesh arr=DataArrayDouble(range(2)) diff --git a/doc/user/images/curvelinear.py b/doc/user/images/curvelinear.py index 268a8e844..056cd16b5 100644 --- a/doc/user/images/curvelinear.py +++ b/doc/user/images/curvelinear.py @@ -64,8 +64,12 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * -from MEDCoupling import * from MEDLoader import WriteMesh m=MEDCouplingCurveLinearMesh("myCurveLinearMesh") diff --git a/doc/user/images/explodeIntoEdges.py b/doc/user/images/explodeIntoEdges.py index 0c626eab6..b07e658ed 100644 --- a/doc/user/images/explodeIntoEdges.py +++ b/doc/user/images/explodeIntoEdges.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(5)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/extractSlice3D.py b/doc/user/images/extractSlice3D.py index 5d34cab18..5b5e1c782 100644 --- a/doc/user/images/extractSlice3D.py +++ b/doc/user/images/extractSlice3D.py @@ -26,7 +26,12 @@ ipar.append("ParaView_1", "empty") # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "ParaViS") -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + from MEDLoader import WriteMesh, WriteFieldUsingAlreadyWrittenMesh medfile1="mesh1.med" diff --git a/doc/user/images/extract_mesh_fetched_nodes.py b/doc/user/images/extract_mesh_fetched_nodes.py index 2a49a353f..5d94de3db 100644 --- a/doc/user/images/extract_mesh_fetched_nodes.py +++ b/doc/user/images/extract_mesh_fetched_nodes.py @@ -65,7 +65,10 @@ ipar.append("VTKViewer_1", """ ipar.append("AP_MODULES_LIST", "Mesh") -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/extract_mesh_ids.py b/doc/user/images/extract_mesh_ids.py index c619c055b..09cca9c67 100644 --- a/doc/user/images/extract_mesh_ids.py +++ b/doc/user/images/extract_mesh_ids.py @@ -64,8 +64,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/extrusion.py b/doc/user/images/extrusion.py index 73f3334c4..324ed6cb3 100644 --- a/doc/user/images/extrusion.py +++ b/doc/user/images/extrusion.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(3)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/intersect_2d1d.py b/doc/user/images/intersect_2d1d.py index 62590010d..49b3d13e7 100644 --- a/doc/user/images/intersect_2d1d.py +++ b/doc/user/images/intersect_2d1d.py @@ -65,8 +65,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh2d=MEDCouplingCMesh("mesh2d") diff --git a/doc/user/images/intersect_2d2d.py b/doc/user/images/intersect_2d2d.py index 37219194c..048ba4133 100644 --- a/doc/user/images/intersect_2d2d.py +++ b/doc/user/images/intersect_2d2d.py @@ -65,8 +65,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh2d=MEDCouplingCMesh("mesh2") diff --git a/doc/user/images/measure_field.py b/doc/user/images/measure_field.py index 24cbd6497..d686fbad0 100644 --- a/doc/user/images/measure_field.py +++ b/doc/user/images/measure_field.py @@ -10,7 +10,12 @@ import salome salome.salome_init() theStudy = salome.myStudy -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + from MEDLoader import WriteMesh, WriteFieldUsingAlreadyWrittenMesh medfile="mesh1.med" diff --git a/doc/user/images/orderConsecutiveCells1D.py b/doc/user/images/orderConsecutiveCells1D.py index 4d26fca62..e2ca078ad 100644 --- a/doc/user/images/orderConsecutiveCells1D.py +++ b/doc/user/images/orderConsecutiveCells1D.py @@ -65,8 +65,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * -from MEDCoupling import * from MEDLoader import WriteMesh coordsArr=DataArrayDouble(range(6)) diff --git a/doc/user/images/orient_2d.py b/doc/user/images/orient_2d.py index d6b8409a8..f5cf417fd 100644 --- a/doc/user/images/orient_2d.py +++ b/doc/user/images/orient_2d.py @@ -65,8 +65,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDLoader import WriteMesh coordsArr=DataArrayDouble(range(6)) diff --git a/doc/user/images/ortho_field.py b/doc/user/images/ortho_field.py index 7d27868d9..f49bc4f78 100644 --- a/doc/user/images/ortho_field.py +++ b/doc/user/images/ortho_field.py @@ -4,7 +4,11 @@ ### This script is intended to be launched in a new SALOME study ### -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(3)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/partition.py b/doc/user/images/partition.py index a669b8221..ba2cd5b99 100644 --- a/doc/user/images/partition.py +++ b/doc/user/images/partition.py @@ -68,9 +68,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * - -from MEDCoupling import * from MEDLoader import ReadMeshFromFile, WriteMesh coordsArr=DataArrayDouble(range(8)) diff --git a/doc/user/images/partition_with_layer.py b/doc/user/images/partition_with_layer.py index e7d64c722..abd4d78bd 100644 --- a/doc/user/images/partition_with_layer.py +++ b/doc/user/images/partition_with_layer.py @@ -68,9 +68,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * - -from MEDCoupling import * from MEDLoader import ReadMeshFromFile, WriteMesh coordsArr=DataArrayDouble(range(8)) diff --git a/doc/user/images/projection_P0P1_dual.py b/doc/user/images/projection_P0P1_dual.py index 59500cc75..2c4c0cf2a 100644 --- a/doc/user/images/projection_P0P1_dual.py +++ b/doc/user/images/projection_P0P1_dual.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * srcCoo=DataArrayDouble([(0,0),(1,0),(3,0),(0,1),(1,1),(3,1)]) src=MEDCouplingUMesh("src",2) diff --git a/doc/user/images/projection_P0P1_meshes.py b/doc/user/images/projection_P0P1_meshes.py index a26adfb7a..92ec7ae3f 100644 --- a/doc/user/images/projection_P0P1_meshes.py +++ b/doc/user/images/projection_P0P1_meshes.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * srcCoo=DataArrayDouble([(0,0),(1,0),(3,0),(0,1),(1,1),(3,1)]) src=MEDCouplingUMesh("src",2) diff --git a/doc/user/images/projection_P1P0_dual.py b/doc/user/images/projection_P1P0_dual.py index 4d925b927..f9b3f9aaa 100644 --- a/doc/user/images/projection_P1P0_dual.py +++ b/doc/user/images/projection_P1P0_dual.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * srcCoo=DataArrayDouble([(0,0),(1,0),(3,0),(0,1),(1,1),(3,1)]) src=MEDCouplingUMesh("src",2) diff --git a/doc/user/images/renumber_nodes.py b/doc/user/images/renumber_nodes.py index 0e15ab61e..ac1603103 100644 --- a/doc/user/images/renumber_nodes.py +++ b/doc/user/images/renumber_nodes.py @@ -68,9 +68,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * - -from MEDCoupling import * from MEDLoader import WriteMesh coordsArr=DataArrayDouble(range(2)) diff --git a/doc/user/images/simplexize.py b/doc/user/images/simplexize.py index 73a350bde..c5edfd6a2 100644 --- a/doc/user/images/simplexize.py +++ b/doc/user/images/simplexize.py @@ -64,9 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(3)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/skin.py b/doc/user/images/skin.py index be8381374..4a212e8b4 100644 --- a/doc/user/images/skin.py +++ b/doc/user/images/skin.py @@ -65,7 +65,11 @@ ipar.append("VTKViewer_1", """ ipar.append("AP_MODULES_LIST", "Mesh") -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(5)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/zones.py b/doc/user/images/zones.py index 73afd5a17..f5e0b6bcd 100644 --- a/doc/user/images/zones.py +++ b/doc/user/images/zones.py @@ -65,7 +65,12 @@ ipar.append("VTKViewer_1", """ ipar.append("AP_MODULES_LIST", "Mesh") -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDLoader import WriteMesh coords=DataArrayDouble(range(6)) diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index f23027b02..d70f0c2e1 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -87,14 +87,21 @@ IF(MEDCOUPLING_BUILD_DOC) swig_ready) ENDIF() +IF(WIN32) + # Under Windows MEDCoupling conflicts wiht medcoupling from PyWrapping + SET(MEDCouling_target_name MEDCouplingCompat) +ELSE() + SET(MEDCouling_target_name MEDCoupling) +ENDIF() + IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") - SWIG_ADD_MODULE(MEDCoupling python MEDCoupling.i) + SWIG_ADD_MODULE(${MEDCouling_target_name} python MEDCoupling.i) ELSE() - SWIG_ADD_LIBRARY(MEDCoupling LANGUAGE python SOURCES MEDCoupling.i) + SWIG_ADD_LIBRARY(${MEDCouling_target_name} LANGUAGE python SOURCES MEDCoupling.i) ENDIF() -SWIG_LINK_LIBRARIES(MEDCoupling ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingcpp) -SWIG_CHECK_GENERATION(MEDCoupling) +SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingcpp) +SWIG_CHECK_GENERATION(${MEDCouling_target_name}) SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_FLAGS "-py3") @@ -119,9 +126,9 @@ SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper) IF(WIN32) SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d) - SET_TARGET_PROPERTIES(_MEDCoupling PROPERTIES DEBUG_OUTPUT_NAME _MEDCoupling_d) + SET_TARGET_PROPERTIES(_${MEDCouling_target_name} PROPERTIES DEBUG_OUTPUT_NAME _${MEDCouling_target_name}_d) ENDIF(WIN32) -INSTALL(TARGETS ${SWIG_MODULE_MEDCoupling_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) +INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCoupling.py ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py) SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON}) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py index 4d3692134..f9e80cf4f 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py index 9589dc0de..bb74613ad 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py index 80f5f6bb0..8ecafdcd0 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py @@ -18,7 +18,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py index 00090fb60..d72103bf5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index b5b326bc4..28cfa11de 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -17,7 +17,13 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py index 30b4af304..455245e49 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py index 99f975407..f6861f0d6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * class MEDCouplingDataForTest: def build2DTargetMesh_1(cls): diff --git a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py index fb60d96a8..13cbd3342 100644 --- a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * import unittest from math import pi, sqrt diff --git a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py index 17acd21f9..28e92fbc4 100644 --- a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py index 90c6f5eb8..0cfc225e3 100644 --- a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * if MEDCouplingHasNumPyBindings(): from numpy import * diff --git a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py index a73bb88ab..a8f7b3cbb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDCouplingDataForTest import MEDCouplingDataForTest if MEDCouplingHasNumPyBindings(): diff --git a/src/MEDCoupling_Swig/UsersGuideExamplesTest.py b/src/MEDCoupling_Swig/UsersGuideExamplesTest.py index cad12285f..314f5c70b 100755 --- a/src/MEDCoupling_Swig/UsersGuideExamplesTest.py +++ b/src/MEDCoupling_Swig/UsersGuideExamplesTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from math import pi, sqrt # ! [PySnippetUMeshStdBuild1_1] diff --git a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py index ad566904a..bf8506fb6 100644 --- a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py +++ b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py @@ -17,12 +17,20 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * -from MEDCoupling import * from math import pi, sqrt import numpy -import MEDCoupling +if sys.platform == "win32": + import MEDCouplingCompat as MEDCoupling +else: + import MEDCoupling + #! [UG_DataArrayNumpy_0] # NumPy is an optional pre-requisite! assert(MEDCoupling.MEDCouplingHasNumPyBindings()) diff --git a/src/PyWrapping/CMakeLists.txt b/src/PyWrapping/CMakeLists.txt index 3d49b5e4a..201ca0393 100644 --- a/src/PyWrapping/CMakeLists.txt +++ b/src/PyWrapping/CMakeLists.txt @@ -83,18 +83,18 @@ IF(MEDCOUPLING_USE_MPI) ENDIF(MEDCOUPLING_USE_MPI) IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") - SWIG_ADD_MODULE(medcoupling1 python medcoupling.i) + SWIG_ADD_MODULE(medcoupling python medcoupling.i) ELSE() - SWIG_ADD_LIBRARY(medcoupling1 LANGUAGE python SOURCES medcoupling.i) + SWIG_ADD_LIBRARY(medcoupling LANGUAGE python SOURCES medcoupling.i) ENDIF() -SWIG_LINK_LIBRARIES(medcoupling1 ${medcoupling_LIB_dependancies}) -SWIG_CHECK_GENERATION(medcoupling1) +SWIG_LINK_LIBRARIES(medcoupling ${medcoupling_LIB_dependancies}) +SWIG_CHECK_GENERATION(medcoupling) IF(WIN32) - SET_TARGET_PROPERTIES(_medcoupling1 PROPERTIES DEBUG_OUTPUT_NAME _medcoupling1_d) + SET_TARGET_PROPERTIES(_medcoupling PROPERTIES DEBUG_OUTPUT_NAME _medcoupling_d) ENDIF(WIN32) -INSTALL(TARGETS _medcoupling1 DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) +INSTALL(TARGETS _medcoupling DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) INSTALL(FILES medcoupling.i medcoupling_pycode DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/medcoupling.py ${MEDCOUPLING_INSTALL_PYTHON}) diff --git a/src/RENUMBER_Swig/MEDRenumberTest.py b/src/RENUMBER_Swig/MEDRenumberTest.py index 8a826141a..f4bb20003 100644 --- a/src/RENUMBER_Swig/MEDRenumberTest.py +++ b/src/RENUMBER_Swig/MEDRenumberTest.py @@ -19,12 +19,17 @@ from MEDRenumber import * import unittest +import sys class MEDRenumberTest(unittest.TestCase): @unittest.skipUnless("BOOST" in RenumberAvailableMethods(),"requires BOOST prerequisite !") def test1(self): - from MEDCoupling import MEDCouplingCMesh + if sys.platform == "win32": + from MEDCouplingCompat import MEDCouplingCMesh + else: + from MEDCoupling import MEDCouplingCMesh + ren=RenumberingFactory("BOOST") arr=DataArrayDouble(10) ; arr.iota() c=MEDCouplingCMesh() ; c.setCoords(arr,arr) diff --git a/src/RENUMBER_Swig/UsersGuideExamplesTest.py b/src/RENUMBER_Swig/UsersGuideExamplesTest.py index d61b6746f..6713ba7ca 100644 --- a/src/RENUMBER_Swig/UsersGuideExamplesTest.py +++ b/src/RENUMBER_Swig/UsersGuideExamplesTest.py @@ -18,10 +18,19 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * +import sys + +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + from math import pi, sqrt -import MEDCoupling +if sys.platform == "win32": + import MEDCouplingCompat as MEDCoupling +else: + import MEDCoupling from MEDCouplingDataForTest import MEDCouplingDataForTest m=MEDCouplingDataForTest.build2DTargetMesh_1(); @@ -34,7 +43,6 @@ mrenum=m[n2o] #! [UG_Optimization_0] #! [UG_Optimization_1] -from MEDCoupling import MEDCouplingSkyLineArray import MEDPartitioner # prepare a MEDPartitioner a,b=m.computeNeighborsOfCells() -- 2.39.2