From 237f3e21bfb5ec8f3ca004daeb744879dcff64de Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Tue, 5 Nov 2019 11:46:52 +0100 Subject: [PATCH] remplacement python2.7 en dur dans des chemins --- src/HYDROGUI/BndConditionsDialog.py | 7 ++++--- src/HYDROGUI/BreachesDialog.py | 4 +++- src/HYDROGUI/InitialConditionsDialog.py | 4 +++- src/HYDROGUI/LiquidBoundariesDialog.py | 4 +++- src/salome_hydro/assignStrickler_gui.py | 4 +++- src/salome_hydro/generate_interpolz.py | 4 +++- src/salome_hydro/interpolz_gui.py | 7 +++---- tests/boundaryConditionsDlgTest.py | 5 +++-- tests/boundaryConditionsTest.py | 5 +++-- 9 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/HYDROGUI/BndConditionsDialog.py b/src/HYDROGUI/BndConditionsDialog.py index e86b16c..474b4be 100755 --- a/src/HYDROGUI/BndConditionsDialog.py +++ b/src/HYDROGUI/BndConditionsDialog.py @@ -26,8 +26,9 @@ from PyQt5 import uic from MEDLoader import MEDFileMesh # TODO: get rid of sys.path.append() ? -hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome') -#sys.path.append(os.path.join(hydro_solver_root, 'salome', 'hydrotools')) +import sysconfig +pythonVersion = 'python' + sysconfig.get_python_version() +hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome') from salome.hydro import boundaryConditions @@ -127,7 +128,7 @@ class BoundaryConditionsDialog(QDialog): """Initialize presets""" def init_presets(self): # TODO: determine another presets path - presets_data_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'tests', 'data') + presets_data_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'tests', 'data') file_path = os.path.join(presets_data_root, 'bnd_conditions_presets.txt') reader = boundaryConditions.PresetReader(file_path) self.presets = reader.read() diff --git a/src/HYDROGUI/BreachesDialog.py b/src/HYDROGUI/BreachesDialog.py index a2cf61c..bedc6e1 100644 --- a/src/HYDROGUI/BreachesDialog.py +++ b/src/HYDROGUI/BreachesDialog.py @@ -3,7 +3,9 @@ import sys, os import string -#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'salome', 'hydro') +#import sysconfig +#pythonVersion = 'python' + sysconfig.get_python_version() +#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome') #import salome #salome.salome_init() diff --git a/src/HYDROGUI/InitialConditionsDialog.py b/src/HYDROGUI/InitialConditionsDialog.py index bb0be2d..d32cd41 100644 --- a/src/HYDROGUI/InitialConditionsDialog.py +++ b/src/HYDROGUI/InitialConditionsDialog.py @@ -3,7 +3,9 @@ import sys, os import string -#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'salome', 'hydro') +#import sysconfig +#pythonVersion = 'python' + sysconfig.get_python_version() +#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome') #import salome #salome.salome_init() diff --git a/src/HYDROGUI/LiquidBoundariesDialog.py b/src/HYDROGUI/LiquidBoundariesDialog.py index f860d89..b10938e 100644 --- a/src/HYDROGUI/LiquidBoundariesDialog.py +++ b/src/HYDROGUI/LiquidBoundariesDialog.py @@ -3,7 +3,9 @@ import sys, os import string -#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'salome', 'hydro') +#import sysconfig +#pythonVersion = 'python' + sysconfig.get_python_version() +#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome') #import salome #salome.salome_init() diff --git a/src/salome_hydro/assignStrickler_gui.py b/src/salome_hydro/assignStrickler_gui.py index b06343d..82a31e2 100644 --- a/src/salome_hydro/assignStrickler_gui.py +++ b/src/salome_hydro/assignStrickler_gui.py @@ -3,7 +3,9 @@ import sys, os import string -hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'salome', 'hydro') +import sysconfig +pythonVersion = 'python' + sysconfig.get_python_version() +hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'salome', 'hydro') import salome salome.salome_init() diff --git a/src/salome_hydro/generate_interpolz.py b/src/salome_hydro/generate_interpolz.py index cb2f9be..d1b4eca 100644 --- a/src/salome_hydro/generate_interpolz.py +++ b/src/salome_hydro/generate_interpolz.py @@ -1,6 +1,8 @@ import os -hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'salome', 'hydro') +import sysconfig +pythonVersion = 'python' + sysconfig.get_python_version() +hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'salome', 'hydro') def replace( lines, pattern, subst ): for i in range( 0, len( lines ) ): diff --git a/src/salome_hydro/interpolz_gui.py b/src/salome_hydro/interpolz_gui.py index cc1156e..742b291 100644 --- a/src/salome_hydro/interpolz_gui.py +++ b/src/salome_hydro/interpolz_gui.py @@ -1,10 +1,9 @@ import sys, os import string -#sys.path.append(os.path.join(os.environ['MEDFILE_ROOT_DIR'], 'lib/python2.7/site-packages/med')) -#sys.path.append(os.path.join(os.environ['MEDFICHIER_INSTALL_DIR'], 'lib/python2.7/site-packages/med')) -hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'salome', 'hydro') -#sys.path.append(hydro_solver_root) +import sysconfig +pythonVersion = 'python' + sysconfig.get_python_version() +hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'salome', 'hydro') import salome salome.salome_init() diff --git a/tests/boundaryConditionsDlgTest.py b/tests/boundaryConditionsDlgTest.py index a74894d..fd759e6 100644 --- a/tests/boundaryConditionsDlgTest.py +++ b/tests/boundaryConditionsDlgTest.py @@ -7,8 +7,9 @@ from PyQt5.QtWidgets import * cur_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(cur_dir, "data") -#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome') -#sys.path.append(hydro_solver_root) +#import sysconfig +#pythonVersion = 'python' + sysconfig.get_python_version() +#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'salome', 'hydro') from BndConditionsDialog import BoundaryConditionsDialog # Show the dialog diff --git a/tests/boundaryConditionsTest.py b/tests/boundaryConditionsTest.py index 238413f..7339a1d 100644 --- a/tests/boundaryConditionsTest.py +++ b/tests/boundaryConditionsTest.py @@ -8,8 +8,9 @@ import unittest cur_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(cur_dir, "data") -#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome') -#sys.path.append(hydro_solver_root) +#import sysconfig +#pythonVersion = 'python' + sysconfig.get_python_version() +#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'salome', 'hydro') import boundaryConditions -- 2.39.2