2024-05-15 15:35:15 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
cmake,
|
|
|
|
cython,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
rapidfuzz,
|
|
|
|
rapidfuzz-cpp,
|
|
|
|
scikit-build,
|
2021-12-06 16:07:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "levenshtein";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.25.1";
|
2024-02-29 20:09:43 +00:00
|
|
|
pyproject = true;
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "maxbachmann";
|
|
|
|
repo = "Levenshtein";
|
2022-07-14 12:49:19 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-ye2XQL/ZQPlA4dy3tlr03WyGhfl7SaOXMt10cWHnW5o=";
|
|
|
|
fetchSubmodules = true; # # for vendored `rapidfuzz-cpp`
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2024-04-21 15:54:59 +00:00
|
|
|
cython
|
2022-04-27 09:35:20 +00:00
|
|
|
scikit-build
|
|
|
|
];
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
2021-12-19 01:06:50 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
buildInputs = [ rapidfuzz-cpp ];
|
2022-07-14 12:49:19 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (
|
|
|
|
lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
|
|
|
|
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
|
|
|
|
]
|
|
|
|
);
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [ rapidfuzz ];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
pythonImportsCheck = [ "Levenshtein" ];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Functions for fast computation of Levenshtein distance and string similarity";
|
|
|
|
homepage = "https://github.com/maxbachmann/Levenshtein";
|
2023-04-29 16:46:19 +00:00
|
|
|
changelog = "https://github.com/maxbachmann/Levenshtein/blob/${src.rev}/HISTORY.md";
|
2021-12-06 16:07:01 +00:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|