From 74d8a5f072807199b9f751af688be8fa51590f61 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 31 Mar 2025 18:32:47 +0200 Subject: [PATCH] python312Packages.swh-perfecthash: init at 1.3.2 --- .../swh-perfecthash/default.nix | 62 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 64 insertions(+) create mode 100644 pkgs/development/python-modules/swh-perfecthash/default.nix diff --git a/pkgs/development/python-modules/swh-perfecthash/default.nix b/pkgs/development/python-modules/swh-perfecthash/default.nix new file mode 100644 index 000000000000..821b1c6bf255 --- /dev/null +++ b/pkgs/development/python-modules/swh-perfecthash/default.nix @@ -0,0 +1,62 @@ +{ + lib, + buildPythonPackage, + fetchFromGitLab, + setuptools, + setuptools-scm, + cffi, + pytestCheckHook, + pytest-mock, + pkgs, # only for cmph +}: + +buildPythonPackage rec { + pname = "swh-perfecthash"; + version = "1.3.2"; + pyproject = true; + + src = fetchFromGitLab { + domain = "gitlab.softwareheritage.org"; + group = "swh"; + owner = "devel"; + repo = "swh-perfecthash"; + tag = "v${version}"; + hash = "sha256-cG0h0lfSSooA7Mzrlsi5yIcbkbxQZ7mI5NtiB7D5Crs="; + }; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + cffi + pkgs.cmph + ]; + + # The installed library clashes with the `swh` directory remaining in the source path. + # Usually, we get around this by `rm -rf` the python source files to ensure that the installed package is used. + # Here, we cannot do that as it would also remove the tests which are also in the `swh` directory. + preCheck = '' + rm -rf swh/perfecthash/*.py + ''; + + pythonImportsCheck = [ "swh.perfecthash" ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-mock + ]; + + disabledTests = [ + # Flake tests + "test_build_speed" + ]; + + meta = { + description = "Perfect hash table for software heritage object storage"; + homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-perfecthash"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index edf440be213a..029d037dce48 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -16661,6 +16661,8 @@ self: super: with self; { swh-model = callPackage ../development/python-modules/swh-model { }; + swh-perfecthash = callPackage ../development/python-modules/swh-perfecthash { }; + swh-scanner = callPackage ../development/python-modules/swh-scanner { }; swh-web-client = callPackage ../development/python-modules/swh-web-client { };