Update patch for Python-3.12| Enable python tests on Power64 builds

This commit is contained in:
Antonio Trande 2023-06-22 20:19:31 +02:00
parent 2eb306a14c
commit 3c37bea5fb
2 changed files with 48 additions and 5 deletions

View File

@ -45,10 +45,10 @@ index 7a74fd06d31..bb1c3e62b55 100755
# Check to ensure that the environmental variable PETSC_DIR has been assigned. # Check to ensure that the environmental variable PETSC_DIR has been assigned.
# MPLCONFIGDIR is needed for matplotlib # MPLCONFIGDIR is needed for matplotlib
diff --git a/src/binding/petsc4py/src/lib/__init__.py b/src/binding/petsc4py/src/lib/__init__.py diff --git a/src/lib/__init__.py b/src/lib/__init__.py
index 85e9daf118e..310334eae21 100644 index 85e9daf118e..310334eae21 100644
--- a/src/binding/petsc4py/src/lib/__init__.py --- a/src/lib/__init__.py
+++ b/src/binding/petsc4py/src/lib/__init__.py +++ b/src/lib/__init__.py
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
This package is a holds all the available variants of the PETSc This package is a holds all the available variants of the PETSc
@ -110,3 +110,48 @@ index 85e9daf118e..310334eae21 100644
# silence annoying Cython warning # silence annoying Cython warning
warnings.filterwarnings("ignore", message="numpy.dtype size changed") warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ndarray size changed") warnings.filterwarnings("ignore", message="numpy.ndarray size changed")
From c36e9c688a542448939d85251c93951e001443de Mon Sep 17 00:00:00 2001
From: "Jose E. Roman" <jroman@dsic.upv.es>
Date: Thu, 22 Jun 2023 10:28:53 +0200
Subject: [PATCH 2/2] script.py: improve portability for python < 3.5
---
config/BuildSystem/script.py | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/config/BuildSystem/script.py b/config/BuildSystem/script.py
index f120d335712..d3305288195 100644
--- a/config/BuildSystem/script.py
+++ b/config/BuildSystem/script.py
@@ -132,12 +132,23 @@ class Script(logger.Logger):
@staticmethod
def getModule(root, name):
'''Retrieve a specific module from the directory root, bypassing the usual paths'''
- import importlib.util
-
- spec = importlib.util.spec_from_file_location(name, root)
- module = importlib.util.module_from_spec(spec)
- sys.modules[name] = module
- spec.loader.exec_module(module)
+ try:
+ import importlib.util
+ except ImportError:
+ importlib = None
+ import imp
+
+ if importlib and sys.version_info > (3,4):
+ spec = importlib.util.spec_from_file_location(name, root)
+ module = importlib.util.module_from_spec(spec) # novermin
+ sys.modules[name] = module
+ spec.loader.exec_module(module)
+ else:
+ (fp, pathname, description) = imp.find_module(name, [root])
+ try:
+ return imp.load_module(name, fp, pathname, description)
+ finally:
+ if fp: fp.close()
@staticmethod
def importModule(moduleName):
--
GitLab

View File

@ -13,9 +13,7 @@
# Python binding and its testing # Python binding and its testing
%bcond_without python %bcond_without python
%ifnarch %{power64} %{arm}
%bcond_without pycheck %bcond_without pycheck
%endif
%global pymodule_name petsc4py %global pymodule_name petsc4py
%global pymodule_version %{version} %global pymodule_version %{version}
# #