124e666
diff -rupN --no-dereference gmsh-4.12.1-source/CMakeLists.txt gmsh-4.12.1-source-new/CMakeLists.txt
124e666
--- gmsh-4.12.1-source/CMakeLists.txt	2024-01-11 11:22:45.000000000 +0100
124e666
+++ gmsh-4.12.1-source-new/CMakeLists.txt	2024-01-14 16:15:45.343990228 +0100
7fb3086
@@ -1945,6 +1945,8 @@ else()
dbd8682
   set(GMSH_INC ${CMAKE_INSTALL_INCLUDEDIR})
0b3a554
 endif()
dbd8682
 
dbd8682
+execute_process ( COMMAND python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" OUTPUT_VARIABLE PYTHON3_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
dbd8682
+
2543855
 # mark targets as optional so we can install them separately if needed
2543855
 # (e.g. "make lib" or "make shared" followed by "make install/fast")
2543855
 install(TARGETS gmsh DESTINATION ${GMSH_BIN} OPTIONAL)
7fb3086
@@ -1956,14 +1958,14 @@ if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_D
0b3a554
 endif()
dbd8682
 
11a22ea
 if(ENABLE_ONELAB AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/onelab)
dbd8682
-  install(FILES ${ONELAB_PY} DESTINATION ${GMSH_BIN})
dbd8682
+  install(FILES ${ONELAB_PY} DESTINATION ${PYTHON3_SITE_PACKAGES})
0b3a554
 endif()
dbd8682
 if(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
dbd8682
   install(FILES ${GMSH_API} DESTINATION ${GMSH_INC})
dbd8682
-  install(FILES ${GMSH_PY} DESTINATION ${GMSH_LIB})
dbd8682
+  install(FILES ${GMSH_PY} DESTINATION ${PYTHON3_SITE_PACKAGES})
dbd8682
   install(FILES ${GMSH_JL} DESTINATION ${GMSH_LIB})
abc989a
   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/METADATA DESTINATION
abc989a
-                ${GMSH_LIB}/gmsh-${GMSH_PYTHON_VERSION}.dist-info)
abc989a
+                ${PYTHON3_SITE_PACKAGES}/gmsh-${GMSH_PYTHON_VERSION}.dist-info)
dbd8682
   if(ENABLE_PRIVATE_API)
dbd8682
     install(FILES ${GMSH_PRIVATE_API} DESTINATION ${GMSH_INC}/gmsh)
abc989a
     if(HAVE_CONTRIB_EIGEN) # the private API depends on Eigen
124e666
diff -rupN --no-dereference gmsh-4.12.1-source/src/common/GmshMessage.cpp gmsh-4.12.1-source-new/src/common/GmshMessage.cpp
124e666
--- gmsh-4.12.1-source/src/common/GmshMessage.cpp	2024-01-11 11:22:47.000000000 +0100
124e666
+++ gmsh-4.12.1-source-new/src/common/GmshMessage.cpp	2024-01-14 16:15:45.343990228 +0100
a63b3c4
@@ -173,14 +173,6 @@ void Msg::Initialize(int argc, char **ar
e28eba6
   if(CTX::instance()->exeFileName.empty() && _commandLineArgs.size())
e28eba6
     CTX::instance()->exeFileName = _commandLineArgs[0];
dbd8682
 
11a22ea
-  if(_env) {
11a22ea
-    // add the directory where the binary is installed to the path where Python
11a22ea
-    // looks for modules, and to the path for executables (this allows us to
11a22ea
-    // find the onelab.py module or subclients automatically)
11a22ea
-    addGmshPathToEnvironmentVar("PYTHONPATH");
11a22ea
-    addGmshPathToEnvironmentVar("PATH");
11a22ea
-  }
dbd8682
-
11a22ea
   if(_locale) {
11a22ea
     // make sure to use the "C" locale; in particular this ensures that we will
11a22ea
     // use a dot for for the decimal separator when writing ASCII mesh files