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

python312Packages.phe: enable tests, refactor, adopt

parent 88e15c49
Loading
Loading
Loading
Loading
+33 −16
Original line number Diff line number Diff line
{ lib, buildPythonPackage, fetchPypi, isPyPy, isPy3k, click, gmpy2, numpy } :
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  isPyPy,
  isPy3k,
  setuptools,
  click,
  gmpy2,
  pytestCheckHook,
  numpy,
}:

let
buildPythonPackage rec {
  pname = "phe";
  version = "1.5.0";
  format = "setuptools";
in
  pyproject = true;

buildPythonPackage {
  inherit pname version;

  # https://github.com/n1analytics/python-paillier/issues/51
  # https://github.com/data61/python-paillier/issues/51
  disabled = isPyPy || !isPy3k;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-mS+3CR0kJ/DZczlG+PNQrN1NHQEgV/Kq02S6eflwM5w=";
  src = fetchFromGitHub {
    owner = "data61";
    repo = "python-paillier";
    rev = "refs/tags/${version}";
    hash = "sha256-fsZ8x/K+8V4zyVgkci6XNAm89zQFWEbmRVp4jazFfVY=";
  };

  buildInputs = [ click gmpy2 numpy ];
  build-system = [ setuptools ];

  dependencies = [
    click
    gmpy2 # optional, but major speed improvement
  ];

  # 29/233 tests fail
  doCheck = false;
  nativeCheckInputs = [
    pytestCheckHook
    numpy
  ];

  meta = with lib; {
    description = "A library for Partially Homomorphic Encryption in Python";
    mainProgram = "pheutil";
    homepage = "https://github.com/n1analytics/python-paillier";
    homepage = "https://github.com/data61/python-paillier";
    license = licenses.gpl3;
    maintainers = with maintainers; [ tomasajt ];
  };
}