Unverified Commit 57a132d4 authored by OTABI Tomoya's avatar OTABI Tomoya Committed by GitHub
Browse files

python3Packages.zstandard: modernize (#412698)

parents d5f71c84 5a24de05
Loading
Loading
Loading
Loading
+30 −10
Original line number Diff line number Diff line
@@ -2,35 +2,55 @@
  lib,
  buildPythonPackage,
  fetchPypi,
  isPyPy,
  cffi,
  setuptools,
  hypothesis,
  pythonOlder,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "zstandard";
  version = "0.23.0";
  format = "setuptools";

  disabled = pythonOlder "3.6";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-stjGLQjnJV9o96dAuuhbPJuOVGa6qcv39X8c3grGvAk=";
  };

  propagatedNativeBuildInputs = [ cffi ];
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "setuptools<69.0.0" "setuptools" \
      --replace-fail "cffi==" "cffi>="
  '';

  build-system = [
    cffi
    setuptools
  ];

  dependencies = lib.optionals isPyPy [ cffi ];

  # python-zstandard depends on unstable zstd C APIs and may break with version mismatches,
  # so we don't provide system zstd for this package
  # https://github.com/indygreg/python-zstandard/blob/9eb56949b1764a166845e065542690942a3203d3/c-ext/backend_c.c#L137-L150

  propagatedBuildInputs = [ cffi ];
  nativeCheckInputs = [
    hypothesis
    pytestCheckHook
  ];

  nativeCheckInputs = [ hypothesis ];
  preCheck = ''
    rm -r zstandard
  '';

  pythonImportsCheck = [ "zstandard" ];

  meta = with lib; {
  meta = {
    description = "zstandard bindings for Python";
    homepage = "https://github.com/indygreg/python-zstandard";
    license = licenses.bsdOriginal;
    maintainers = with maintainers; [ arnoldfarkas ];
    license = lib.licenses.bsdOriginal;
    maintainers = with lib.maintainers; [ arnoldfarkas ];
  };
}