Unverified Commit f91cd16b authored by TomaSajt's avatar TomaSajt
Browse files

python312Packages.gmpy2: 2.1.2 -> 2.2.0a2, refactor, adopt

parent 9f7053ff
Loading
Loading
Loading
Loading
+56 −25
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchFromGitHub
, isPyPy
, gmp
, mpfr
, libmpc

{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  isPyPy,
  pythonOlder,
  setuptools,
  gmp,
  mpfr,
  libmpc,
  pytestCheckHook,
  hypothesis,
  cython,
  mpmath,
  # Reverse dependency
, sage
  sage,
}:

let
buildPythonPackage rec {
  pname = "gmpy2";
  version = "2.1.2";
  format = "setuptools";
in

buildPythonPackage {
  inherit pname version;
  version = "2.2.0a2";
  pyproject = true;

  disabled = isPyPy;
  disabled = isPyPy || pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "aleaxit";
    repo = "gmpy";
    rev = "gmpy2-${version}";
    hash = "sha256-ARCttNzRA+Ji2j2NYaSCDXgvoEg01T9BnYadyqON2o0=";
    rev = "refs/tags/gmpy2-${version}";
    hash = "sha256-luLEDEY1cezhzZo4fXmM/MUg2YyAaz7n0HwSpbNayP8=";
  };

  buildInputs = [ gmp mpfr libmpc ];
  build-system = [ setuptools ];

  buildInputs = [
    gmp
    mpfr
    libmpc
  ];

  # make relative imports in tests work properly
  preCheck = ''
    rm gmpy2 -r
  '';

  nativeCheckInputs = [
    pytestCheckHook
    hypothesis
    cython
    mpmath
  ];

  disabledTests = lib.optionals (stdenv.isLinux && stdenv.isAarch64) [
    # issue with some overflow logic
    "test_mpz_to_bytes"
    "test_mpz_from_bytes"
  ];

  pythonImportsCheck = [ "gmpy2" ];

  passthru.tests = { inherit sage; };
  passthru.tests = {
    inherit sage;
  };

  meta = with lib; {
    description = "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x";
  meta = {
    changelog = "https://github.com/aleaxit/gmpy/blob/${src.rev}/docs/history.rst";
    description = "Interface to GMP, MPFR, and MPC for Python 3.7+";
    homepage = "https://github.com/aleaxit/gmpy/";
    license = licenses.gpl3Plus;
    license = lib.licenses.lgpl3Plus;
    maintainers = with lib.maintainers; [ tomasajt ];
  };
}