2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
2022-12-17 10:02:37 +00:00
|
|
|
, stdenv
|
2021-12-06 16:07:01 +00:00
|
|
|
, buildPythonPackage
|
2022-04-27 09:35:20 +00:00
|
|
|
, cmake
|
2023-08-22 20:05:09 +00:00
|
|
|
, cython_3
|
2024-02-29 20:09:43 +00:00
|
|
|
, fetchFromGitHub
|
2021-12-06 16:07:01 +00:00
|
|
|
, pytestCheckHook
|
2024-02-29 20:09:43 +00:00
|
|
|
, pythonOlder
|
2021-12-06 16:07:01 +00:00
|
|
|
, rapidfuzz
|
2022-07-14 12:49:19 +00:00
|
|
|
, rapidfuzz-cpp
|
2022-04-27 09:35:20 +00:00
|
|
|
, scikit-build
|
2021-12-06 16:07:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "levenshtein";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "0.25.0";
|
|
|
|
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-02-29 20:09:43 +00:00
|
|
|
hash = "sha256-MkzIwTZU8hqPDOlfN4qADCKjGJIQrNhhOmVRAnAfNK0=";
|
2024-01-25 14:12:00 +00:00
|
|
|
fetchSubmodules = true; ## for vendored `rapidfuzz-cpp`
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2023-08-22 20:05:09 +00:00
|
|
|
cython_3
|
2022-04-27 09:35:20 +00:00
|
|
|
scikit-build
|
|
|
|
];
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
2021-12-19 01:06:50 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
buildInputs = [
|
|
|
|
rapidfuzz-cpp
|
|
|
|
];
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
|
2022-12-17 10:02:37 +00:00
|
|
|
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
|
2023-03-04 12:14:45 +00:00
|
|
|
]);
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
rapidfuzz
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"Levenshtein"
|
|
|
|
];
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|