python3Packages.cypari: build gmp and pari separately

This commit is contained in:
Alex Epelde
2025-08-20 20:42:49 -04:00
parent a3f1cfb8c4
commit 7adef789ef
2 changed files with 25 additions and 27 deletions

View File

@@ -3,29 +3,13 @@
python,
buildPythonPackage,
fetchFromGitHub,
fetchurl,
setuptools,
cython,
bash,
gmp,
pari,
perl,
gnum4,
texliveBasic,
}:
let
pariVersion = "2.15.4";
gmpVersion = "6.3.0";
pariSrc = fetchurl {
url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor pariVersion}/pari-${pariVersion}.tar.gz";
hash = "sha256-w1Rb/uDG37QLd/tLurr5mdguYAabn20ovLbPAEyMXA8=";
};
gmpSrc = fetchurl {
url = "https://ftp.gnu.org/gnu/gmp/gmp-${gmpVersion}.tar.bz2";
hash = "sha256-rCghGnz7YJuuLiyNYFjWbI/pZDT3QM9v4uR7AA0cIMs=";
};
in
buildPythonPackage rec {
pname = "cypari";
version = "2.5.5";
@@ -39,13 +23,15 @@ buildPythonPackage rec {
};
postPatch = ''
substituteInPlace ./setup.py \
--replace-fail "/bin/bash" "${lib.getExe bash}"
# final character is stripped from PARI error messages for some reason
substituteInPlace ./cypari/handle_error.pyx \
--replace-fail "not a function in function call" "not a function in function cal"
ln -s ${pariSrc} ${pariSrc.name}
ln -s ${gmpSrc} ${gmpSrc.name}
'';
preBuild = ''
mkdir libcache
ln -s ${gmp} libcache/gmp
ln -s ${pari} libcache/pari
'';
build-system = [
@@ -53,12 +39,8 @@ buildPythonPackage rec {
cython
];
NIX_LDFLAGS = "-lc";
nativeBuildInputs = [
gnum4
perl
texliveBasic
];
pythonImportsCheck = [ "cypari" ];

View File

@@ -3278,7 +3278,23 @@ self: super: with self; {
cynthion = callPackage ../development/python-modules/cynthion { };
cypari = callPackage ../development/python-modules/cypari { };
cypari = callPackage ../development/python-modules/cypari {
inherit (pkgs.pkgsStatic) gmp;
pari = pkgs.pari.overrideAttrs rec {
version = "2.15.4";
src = pkgs.fetchurl {
url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor version}/pari-${version}.tar.gz";
hash = "sha256-w1Rb/uDG37QLd/tLurr5mdguYAabn20ovLbPAEyMXA8=";
};
installTargets = [
"install"
"install-lib-sta"
];
};
};
cypari2 = callPackage ../development/python-modules/cypari2 { };