Merge pull request #281579 from collares/cypari214

python311Packages.cypari2: fix build
This commit is contained in:
Mauricio Collares 2024-01-20 13:00:19 +01:00 committed by GitHub
commit 9e6a169957
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 14 deletions

View file

@ -30,20 +30,13 @@ buildPythonPackage rec {
})
];
# This differs slightly from the default python installPhase in that it pip-installs
# "." instead of "*.whl".
# That is because while the default install phase succeeds to build the package,
# it fails to generate the file "auto_paridecl.pxd".
installPhase = ''
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
# install "." instead of "*.whl"
pip install . --no-index --no-warn-script-location --prefix="$out" --no-cache
preBuild = ''
# generate cythonized extensions (auto_paridecl.pxd is crucial)
${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
'';
nativeBuildInputs = [
pari
python.pythonOnBuildForHost.pkgs.pip
];
buildInputs = [
@ -56,6 +49,7 @@ buildPythonPackage rec {
];
checkPhase = ''
test -f "$out/${python.sitePackages}/cypari2/auto_paridecl.pxd"
make check
'';

View file

@ -1,8 +1,9 @@
{ lib
, autoreconfHook
, fetchpatch
, fetchPypi
, buildPythonPackage
, cython_3
, cython
, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
}:
@ -18,6 +19,14 @@ buildPythonPackage rec {
hash = "sha256-Dx4yHlWgf5AchqNqHkSX9v+d/nAGgdATCjjDbk6yOMM=";
};
patches = [
# https://github.com/sagemath/cysignals/pull/193
(fetchpatch {
url = "https://github.com/sagemath/cysignals/commit/474179c87ab0ff562fdfd2471b02797e4bdd3148.diff";
sha256 = "sha256-qEAmf4kU+QDI/JPFNjQMZIjMBk8dnaLmOpagIBMsh7w=";
})
];
# explicit check:
# build/src/cysignals/implementation.c:27:2: error: #error "cysignals must be compiled without _FORTIFY_SOURCE"
hardeningDisable = [
@ -34,7 +43,7 @@ buildPythonPackage rec {
'';
propagatedBuildInputs = [
cython_3
cython
] ++ lib.optionals pariSupport [
# When cysignals is built with pari, including cysignals into the
# buildInputs of another python package will cause cython to link against

View file

@ -1,10 +1,11 @@
{ lib
, fetchFromGitHub
, fetchpatch
, buildPythonPackage
# build-system
, cysignals
, cython_3
, cython
, pkgconfig
, setuptools
@ -30,8 +31,21 @@ buildPythonPackage rec {
hash = "sha256-EyReCkVRb3CgzIRal5H13OX/UdwWi+evDe7PoS1qP4A=";
};
# temporarily revert to cython 0.29
patches = [
(fetchpatch {
url = "https://github.com/fplll/fpylll/commit/528243c6fa6491c8e9652b99bdf9758766273d66.diff";
revert = true;
sha256 = "sha256-IRppkESy0CRwARhxBAsZxP6JkTe0M91apG4CTSSYNUU=";
excludes = ["requirements.txt"];
})
];
postPatch = ''
substituteInPlace requirements.txt --replace "Cython>=3.0" "Cython"
'';
nativeBuildInputs = [
cython_3
cython
cysignals
pkgconfig
setuptools