diff --git a/petsc-3.18.5-fix_make_compatibility.patch b/petsc-3.18.5-fix_make_compatibility.patch deleted file mode 100644 index 5173297..0000000 --- a/petsc-3.18.5-fix_make_compatibility.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 5ef50a0f30184c572c1829d0a161b2eb8af8a6a3 Mon Sep 17 00:00:00 2001 -From: Satish Balay -Date: Fri, 3 Mar 2023 11:10:06 -0600 -Subject: [PATCH] GNUMake 4.4.1 requires MAKEFLAGS to be in the correct order. - Prepending -j results in errors when using --print-directory (as it gets - translated to 'w') - -Fixed by not modifying MAKEFLAGS - -Using MAKE: /home/balay/tmp/make-4.4.1/gmake -Using MAKEFLAGS: -j10 -l18.0 w -- PETSC_DIR=/home/balay/petsc PETSC_ARCH=arch-linux-c-debug -========================================== -gmake[3]: Entering directory '/home/balay/petsc' -/usr/bin/python3 ./config/gmakegen.py --petsc-arch=arch-linux-c-debug -/usr/bin/python3 /home/balay/petsc/config/gmakegentest.py --petsc-dir=/home/balay/petsc --petsc-arch=arch-linux-c-debug --testdir=./arch-linux-c-debug/tests -gmake[3]: *** No rule to make target 'w'. Stop. ---- - lib/petsc/conf/rules | 16 +++++++++++++++- - makefile | 4 ++-- - 2 files changed, 17 insertions(+), 3 deletions(-) - -diff --git a/lib/petsc/conf/rules b/lib/petsc/conf/rules -index 7219d0274e7..a24e64130c4 100644 ---- a/lib/petsc/conf/rules -+++ b/lib/petsc/conf/rules -@@ -53,7 +53,21 @@ ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles: - @${MKDIR} -p ${PETSC_DIR}/${PETSC_ARCH}/tests && touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles - - libs: ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles -- +@cd ${PETSC_DIR} && MAKEFLAGS="-j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" ${OMAKE_PRINTDIR} -f gmakefile ${MAKE_PAR_OUT_FLG} V=${V} libs -+ +@r=`echo "${MAKEFLAGS}" | grep ' \-j'`; \ -+ if [ "$$?" = 0 ]; then \ -+ make_j="";\ -+ echo "Skipping adding -jMAKE_NP option as -j option is already specified"; \ -+ else \ -+ make_j="-j${MAKE_NP}"; \ -+ fi; \ -+ r=`echo "${MAKEFLAGS}" | grep ' \-l'`; \ -+ if [ "$$?" = 0 ]; then \ -+ make_l="";\ -+ echo "Skipping adding -lMAKE_LOAD option as -l option is already specified"; \ -+ else \ -+ make_l="-l${MAKE_LOAD}"; \ -+ fi; \ -+ cd ${PETSC_DIR} && ${OMAKE_PRINTDIR} -f gmakefile $${make_j} $${make_l} ${MAKE_PAR_OUT_FLG} V=${V} libs - - # Does nothing; needed for some rules that require actions. - foo: -diff --git a/makefile b/makefile -index a8329057970..8cdd2fc5af1 100644 ---- a/makefile -+++ b/makefile -@@ -122,8 +122,8 @@ info: - -@echo "------------------------------------------" - -@echo "Using mpiexec: ${MPIEXEC}" - -@echo "------------------------------------------" -- -@echo "Using MAKE: $(MAKE)" -- -@echo "Using MAKEFLAGS: -j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" -+ -@echo "Using MAKE: ${MAKE}" -+ -@echo "Default MAKEFLAGS: MAKE_NP:${MAKE_NP} MAKE_LOAD:${MAKE_LOAD} MAKEFLAGS:${MAKEFLAGS}" - -@echo "==========================================" - - # --- -GitLab - diff --git a/petsc-3.18.5-fix_python312_compatibility.patch b/petsc-3.18.5-fix_python312_compatibility.patch deleted file mode 100644 index 7071ef1..0000000 --- a/petsc-3.18.5-fix_python312_compatibility.patch +++ /dev/null @@ -1,157 +0,0 @@ -From f2ed88371e6f236237267476ee72a064ae0cd70f Mon Sep 17 00:00:00 2001 -From: "Jose E. Roman" -Date: Tue, 20 Jun 2023 17:31:19 +0200 -Subject: [PATCH] Fix for python-3.12: 'imp' module has been removed - -Fixes #1401 ---- - config/BuildSystem/script.py | 11 +++--- - lib/petsc/bin/petsc_tas_analysis.py | 1 - - .../petsc4py/src/petsc4py/lib/__init__.py | 38 ++++++++++++++----- - 3 files changed, 33 insertions(+), 17 deletions(-) - -diff --git a/config/BuildSystem/script.py b/config/BuildSystem/script.py -index 5dbf2934fff..f120d335712 100644 ---- a/config/BuildSystem/script.py -+++ b/config/BuildSystem/script.py -@@ -132,13 +132,12 @@ class Script(logger.Logger): - @staticmethod - def getModule(root, name): - '''Retrieve a specific module from the directory root, bypassing the usual paths''' -- import imp -+ import importlib.util - -- (fp, pathname, description) = imp.find_module(name, [root]) -- try: -- return imp.load_module(name, fp, pathname, description) -- finally: -- if fp: fp.close() -+ 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) - - @staticmethod - def importModule(moduleName): -diff --git a/lib/petsc/bin/petsc_tas_analysis.py b/lib/petsc/bin/petsc_tas_analysis.py -index 7a74fd06d31..bb1c3e62b55 100755 ---- a/lib/petsc/bin/petsc_tas_analysis.py -+++ b/lib/petsc/bin/petsc_tas_analysis.py -@@ -4,7 +4,6 @@ import os - import sys - import importlib - import datetime as date --import importlib - - # Check to ensure that the environmental variable PETSC_DIR has been assigned. - # MPLCONFIGDIR is needed for matplotlib -diff --git a/src/lib/__init__.py b/src/lib/__init__.py -index 85e9daf118e..310334eae21 100644 ---- a/src/lib/__init__.py -+++ b/src/lib/__init__.py -@@ -13,7 +13,7 @@ - - This package is a holds all the available variants of the PETSc - extension module built against specific PETSc configurations. It also --provides a convenience function using of the builtin ``imp`` module -+provides a convenience function using of the ``importlib`` module - for easily importing any of the available extension modules depending - on the value of a user-provided configuration name, the ``PETSC_ARCH`` - environmental variable, or a configuration file. -@@ -45,19 +45,35 @@ - Import helper for PETSc-based extension modules. - """ - import sys, os, warnings -- # TODO: use 'importlib' module under Python 3 -- with warnings.catch_warnings(): -- warnings.filterwarnings("ignore") -+ try: -+ import importlib.machinery -+ import importlib.util -+ except ImportError: -+ importlib = None - import imp - def get_ext_suffix(): -- return imp.get_suffixes()[0][0] -+ if importlib: -+ return importlib.machinery.EXTENSION_SUFFIXES[0] -+ else: -+ return imp.get_suffixes()[0][0] -+ - def import_module(pkg, name, path, arch): -- fullname = '%s.%s' % (pkg, name) -+ fullname = '{}.{}'.format(pkg, name) - pathlist = [os.path.join(path, arch)] -- f, fn, info = imp.find_module(name, pathlist) -- with f: return imp.load_module(fullname, f, fn, info) -+ if importlib: -+ finder = importlib.machinery.PathFinder() -+ spec = finder.find_spec(fullname, pathlist) -+ module = importlib.util.module_from_spec(spec) -+ sys.modules[fullname] = module -+ spec.loader.exec_module(module) -+ return module -+ else: -+ f, fn, info = imp.find_module(name, pathlist) -+ with f: -+ return imp.load_module(fullname, f, fn, info) -+ - # test if extension module was already imported -- module = sys.modules.get('%s.%s' % (pkg, name)) -+ module = sys.modules.get('{}.{}'.format(pkg, name)) - filename = getattr(module, '__file__', '') - if filename.endswith(get_ext_suffix()): - # if 'arch' is None, do nothing; otherwise this -@@ -66,6 +82,7 @@ - if arch is not None and arch != module.__arch__: - raise ImportError("%s already imported" % module) - return module -+ - # silence annoying Cython warning - warnings.filterwarnings("ignore", message="numpy.dtype size changed") - warnings.filterwarnings("ignore", message="numpy.ndarray size changed") -From c36e9c688a542448939d85251c93951e001443de Mon Sep 17 00:00:00 2001 -From: "Jose E. Roman" -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 diff --git a/petsc-3.19.4-fix_Cython_requirement.patch b/petsc-3.19.4-fix_Cython_requirement.patch deleted file mode 100644 index e119c65..0000000 --- a/petsc-3.19.4-fix_Cython_requirement.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/conf/confpetsc.orig.py 2023-07-31 17:00:55.000000000 +0200 -+++ b/conf/confpetsc.py 2023-08-11 12:45:52.386371527 +0200 -@@ -100,7 +100,7 @@ - return False - REQUIRED = Version(VERSION) - PROVIDED = Version(m.groups()[0]) -- if PROVIDED != REQUIRED: -+ if PROVIDED < REQUIRED: - warn("You need Cython == {0} (you have version {1})" - .format(VERSION, CYTHON_VERSION)) - return False -@@ -130,7 +130,7 @@ - return - finally: - os.chdir(cwd) -- require = 'Cython == %s' % VERSION -+ require = 'Cython == 0.29.36' - if setuptools and not cython_chk(VERSION, verbose=False): - if sys.modules.get('Cython'): - removed = getattr(sys.modules['Cython'], '__version__', '') diff --git a/petsc.spec b/petsc.spec index 16086a0..76a9cf9 100644 --- a/petsc.spec +++ b/petsc.spec @@ -290,7 +290,6 @@ Release: %autorelease License: BSD URL: https://petsc.org/ Source0: https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-with-docs-%{version}.tar.gz -Source1: https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc4py-%{version}.tar.gz # These files have been generated by Cython-0.29.36 # PETSC-3.19 is not compatible with Cython-3.0.0 yet @@ -298,20 +297,17 @@ Source1: https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc4py-%{version} Source2: %{name}-PETSc_cython0.29.36.c Source3: %{name}-PETSc_cython0.29.36.h Source4: %{name}-PETSc_api_cython0.29.36.h -Patch9: %{name}-3.19.4-fix_Cython_requirement.patch ## Remove rpath flags Patch0: %{name}-3.11-no-rpath.patch ## Rename library name for 64-bit integer package Patch1: %{name}-lib64.patch -Patch2: %{name}-3.18.5-fix_make_compatibility.patch Patch3: %{name}-3.19.4-fix_mumps_includes.patch Patch4: %{name}-3.19.4-fix_metis64.patch Patch5: %{name}-3.15.0-fix_sundials_version.patch Patch6: %{name}-3.14.1-fix_pkgconfig_file.patch Patch7: %{name}-3.17.0-avoid_fake_MKL_detection.patch -Patch8: %{name}-3.18.5-fix_python312_compatibility.patch %if %{with superlu} BuildRequires: SuperLU-devel >= 5.2.0 @@ -460,10 +456,11 @@ BuildRequires: hdf5-openmpi-devel BuildRequires: scalapack-openmpi-devel BuildRequires: ptscotch-openmpi-devel BuildRequires: python3-numpy -%if 0%{?fedora} <= 37 +%if 0%{?rhel} || 0%{?fedora} < 39 BuildRequires: python3-Cython -%endif +%else BuildRequires: python3-pip +%endif Requires: petsc-openmpi%{?_isa} Requires: hdf5-openmpi%{?_isa} Requires: scalapack-openmpi%{?_isa} @@ -492,10 +489,11 @@ BuildRequires: hdf5-mpich-devel BuildRequires: scalapack-mpich-devel BuildRequires: ptscotch-mpich-devel BuildRequires: python3-numpy -%if 0%{?fedora} <= 37 +%if 0%{?rhel} || 0%{?fedora} < 39 BuildRequires: python3-Cython -%endif +%else BuildRequires: python3-pip +%endif Requires: petsc-mpich%{?_isa} Requires: hdf5-mpich%{?_isa} Requires: scalapack-openmpi%{?_isa} @@ -574,30 +572,7 @@ Portable Extensible Toolkit for Scientific Computation (developer files). %setup -qc %if %{with python} -%setup -q -T -D -a 1 -cp -a petsc4py-%{version}/* %{name}-%{version}/ -rm -rf %{name}-%{version}/*.egg-info -rm -rf %{name}-%{version}/src/binding/petsc4py/src/petsc4py.egg-info -rm -rf petsc4py-%{version} - -# Use pre-generated Cython files -%if 0%{?fedora} > 38 -rm -f %{name}-%{version}/src/binding/petsc4py/src/PETSc.c -install -pm 644 %{SOURCE2} %{name}-%{version}/src/binding/petsc4py/src/PETSc.c -install -pm 644 %{SOURCE2} %{name}-%{version}/src/binding/petsc4py/src/petsc4py/PETSc.c -rm -f %{name}-%{version}/src/binding/petsc4py/src/PETSc.h -install -pm 644 %{SOURCE3} %{name}-%{version}/src/binding/petsc4py/src/PETSc.h -install -pm 644 %{SOURCE3} %{name}-%{version}/src/binding/petsc4py/src/petsc4py/PETSc.h -rm -f %{name}-%{version}/src/binding/petsc4py/src/PETSc_api.h -install -pm 644 %{SOURCE4} %{name}-%{version}/src/binding/petsc4py/src/PETSc_api.h -install -pm 644 %{SOURCE4} %{name}-%{version}/src/binding/petsc4py/src/petsc4py/PETSc_api.h -pushd %{name}-%{version} -%patch -P 9 -p1 -b .backup -popd -%endif - -# Remove pre-generated Cython files -#rm $(grep -rl '/\* Generated by Cython') +rm -rf %{name}-%{version}/src/binding/petsc4py/src/*.egg-info %if 0%{?fedora} for i in `find . -name 'setup.py' -o -name 'configure' -o -name '*.py'`; do @@ -607,12 +582,12 @@ done %endif pushd %{name}-%{version} -#patch -P 2 -p1 -b .backup %patch -P 7 -p1 -b .backup +popd -%if 0%{?python3_version_nodots} >= 312 -#patch -P 8 -p1 -b .backup -%endif +# Remove pregenerated Cython C sources +pushd %{name}-%{version} +#rm $(grep -rl '/\* Generated by Cython') popd %if %{with arch64} @@ -633,9 +608,20 @@ popd %if %{with openmpi} cp -a %{name}-%{version} buildopenmpi_dir +%if 0%{?fedora} > 38 +cp %{SOURCE2} buildopenmpi_dir/src/binding/petsc4py/src/petsc4py/PETSc.c +cp %{SOURCE3} buildopenmpi_dir/src/binding/petsc4py/src/petsc4py/PETSc.h +cp %{SOURCE4} buildopenmpi_dir/src/binding/petsc4py/src/petsc4py/PETSc_api.h %endif +%endif + %if %{with mpich} cp -a %{name}-%{version} buildmpich_dir +%if 0%{?fedora} > 38 +cp %{SOURCE2} buildmpich_dir/src/binding/petsc4py/src/petsc4py/PETSc.c +cp %{SOURCE3} buildmpich_dir/src/binding/petsc4py/src/petsc4py/PETSc.h +cp %{SOURCE4} buildmpich_dir/src/binding/petsc4py/src/petsc4py/PETSc_api.h +%endif %endif # Do NOT move up this patch @@ -709,7 +695,7 @@ popd %endif %if %{with openmpi} -pushd buildopenmpi_dir +cd buildopenmpi_dir %{_openmpi_load} export CC=mpicc @@ -740,19 +726,21 @@ make \ V=1 MAKE_NP=$RPM_BUILD_NCPUS PETSC_DIR=%{_builddir}/%{name}-%{version}/buildopenmpi_dir PETSC_ARCH=%{_arch} all %if %{with python} +pushd src/binding/petsc4py export PETSC_ARCH=%{_arch} -export PETSC_DIR=./ +export PETSC_DIR=../../../ %py3_build unset PETSC_ARCH unset PETSC_DIR -%endif - -%{_openmpi_unload} popd %endif +%{_openmpi_unload} +cd .. +%endif + %if %{with mpich} -pushd buildmpich_dir +cd buildmpich_dir %{_mpich_load} export CC=mpicc @@ -783,15 +771,17 @@ make \ V=1 MAKE_NP=$RPM_BUILD_NCPUS PETSC_DIR=%{_builddir}/%{name}-%{version}/buildmpich_dir PETSC_ARCH=%{_arch} all %if %{with python} +pushd src/binding/petsc4py export PETSC_ARCH=%{_arch} -export PETSC_DIR=./ +export PETSC_DIR=../../../ %py3_build unset PETSC_ARCH unset PETSC_DIR +popd %endif %{_mpich_unload} -popd +cd .. %endif %install @@ -901,9 +891,13 @@ sed -e 's|${PETSC_DIR}|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscr sed -e 's|${PETSC_DIR}|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables %if %{with python} +pushd src/binding/petsc4py export PETSC_ARCH=%{_arch} -export PETSC_DIR=./ -%py3_install +export PETSC_DIR=../../../ +%py3_install -- --verbose +unset PETSC_ARCH +unset PETSC_DIR +popd # Install petsc4py files into MPI directories %if 0%{?rhel} @@ -919,11 +913,11 @@ rm -rf %{buildroot}%{python3_sitearch}/%{pymodule_name}-%{pymodule_version}-py%{ chrpath -r %{_libdir}/openmpi/lib %{buildroot}$MPI_PYTHON3_SITEARCH/%{pymodule_name}/lib/%{_arch}/*.so %endif %{_openmpi_unload} -popd +cd .. %endif %if %{with mpich} -pushd buildmpich_dir +cd buildmpich_dir %{_mpich_load} mkdir -p %{buildroot}$MPI_LIB %{buildroot}$MPI_INCLUDE/%{name} mkdir -p %{buildroot}$MPI_FORTRAN_MOD_DIR/%{name} @@ -960,9 +954,13 @@ sed -e 's|${PETSC_DIR}|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscr sed -e 's|${PETSC_DIR}|%{_prefix}|g' -i %{buildroot}$MPI_LIB/%{name}/conf/petscvariables %if %{with python} +pushd src/binding/petsc4py export PETSC_ARCH=%{_arch} -export PETSC_DIR=./ -%py3_install +export PETSC_DIR=../../../ +%py3_install -- --verbose +unset PETSC_ARCH +unset PETSC_DIR +popd # Install petsc4py files into MPI directories %if 0%{?rhel} @@ -978,7 +976,7 @@ rm -rf %{buildroot}%{python3_sitearch}/%{pymodule_name}-%{pymodule_version}-py%{ chrpath -r %{_libdir}/mpich/lib %{buildroot}$MPI_PYTHON3_SITEARCH/%{pymodule_name}/lib/%{_arch}/*.so %endif %{_mpich_unload} -popd +cd .. %endif # Move html documentation in _pkgdocdir @@ -1199,3 +1197,4 @@ xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C build64 V=1 MPIEXEC='%{_bu %changelog %autochangelog + diff --git a/sources b/sources index 6776e51..0bdf30a 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ SHA512 (petsc-with-docs-3.19.4.tar.gz) = 34011695e33594541132957afffc4f8c94ce3ff71e6322c76630a8afd39a2e91c8ac36c33bd1d749792a0167ee18a742d205b54269eceec2f5cbf01e5ae12809 -SHA512 (petsc4py-3.19.4.tar.gz) = f6ffd84fff1124636b362cdf304137b37f2227a1a188206d70c78ba2bb90032088f0275a5be68c6e6b603e38cb27965fc08bf3f2cf001d63f29675cc984f9d1c