python312Packages.petsc4py: init at 3.22.3

This commit is contained in:
qbisi
2025-02-14 19:18:43 +08:00
parent 0b2160ea3c
commit ad4db6e3ab
3 changed files with 53 additions and 5 deletions
@@ -0,0 +1,22 @@
diff --git a/config/BuildSystem/config/packages/petsc4py.py b/config/BuildSystem/config/packages/petsc4py.py
index 4a58243..831aa04 100644
--- a/config/BuildSystem/config/packages/petsc4py.py
+++ b/config/BuildSystem/config/packages/petsc4py.py
@@ -37,7 +37,7 @@ class Configure(config.package.Package):
def Install(self):
import os
- installLibPath = os.path.join(self.installDir, 'lib')
+ installLibPath = os.path.join(self.installDir, 'lib', '@PYTHON_SITEPACKAGES@')
if self.setCompilers.isDarwin(self.log):
apple = 'You may need to\n (csh/tcsh) setenv MACOSX_DEPLOYMENT_TARGET 10.X\n (sh/bash) MACOSX_DEPLOYMENT_TARGET=10.X; export MACOSX_DEPLOYMENT_TARGET\nbefore running make on PETSc'
else:
@@ -70,7 +70,7 @@ class Configure(config.package.Package):
newdir += 'NUMPY_INCLUDE="'+numpy_include+'" '
self.addDefine('HAVE_PETSC4PY',1)
- self.addDefine('PETSC4PY_INSTALL_PATH','"'+os.path.join(self.installdir.dir,'lib')+'"')
+ self.addDefine('PETSC4PY_INSTALL_PATH','"'+installLibPath+'"')
self.addMakeMacro('PETSC4PY','yes')
self.addMakeRule('petsc4pybuild','', \
['@echo "*** Building petsc4py ***"',\
+25 -5
View File
@@ -4,7 +4,10 @@
fetchzip,
cctools,
gfortran,
replaceVars,
python3,
python3Packages,
withPetsc4py ? false,
blas,
lapack,
mpiSupport ? true,
@@ -51,11 +54,19 @@ stdenv.mkDerivation rec {
};
strictDeps = true;
nativeBuildInputs = [
python3
gfortran
pkg-config
] ++ lib.optional mpiSupport mpi;
nativeBuildInputs =
[
python3
gfortran
pkg-config
]
++ lib.optional mpiSupport mpi
++ lib.optionals withPetsc4py [
python3Packages.setuptools
python3Packages.cython
];
buildInputs =
[
blas
@@ -69,6 +80,14 @@ stdenv.mkDerivation rec {
++ lib.optional withScalapack scalapack
++ lib.optional withMumps mumps_par;
propagatedBuildInputs = lib.optional withPetsc4py python3Packages.numpy;
patches = [
(replaceVars ./fix-petsc4py-install-prefix.patch {
PYTHON_SITEPACKAGES = python3.sitePackages;
})
];
postPatch =
''
patchShebangs ./lib/petsc/bin
@@ -86,6 +105,7 @@ stdenv.mkDerivation rec {
"--with-precision=${petsc-precision}"
"--with-mpi=${if mpiSupport then "1" else "0"}"
]
++ lib.optional withPetsc4py "--with-petsc4py=1"
++ lib.optionals mpiSupport [
"--CC=mpicc"
"--with-cxx=mpicxx"
+6
View File
@@ -10342,6 +10342,12 @@ self: super: with self; {
pesq = callPackage ../development/python-modules/pesq { };
petsc4py = toPythonModule (pkgs.petsc.override {
python3 = python;
python3Packages = self;
withPetsc4py = true;
});
pex = callPackage ../development/python-modules/pex { };
pexif = callPackage ../development/python-modules/pexif { };