c7cb07f092
GitOrigin-RevId: 1536926ef5621b09bba54035ae2bb6d806d72ac8
64 lines
1.3 KiB
Nix
64 lines
1.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildPythonPackage
|
|
, cmake
|
|
, cython_3
|
|
, fetchFromGitHub
|
|
, pytestCheckHook
|
|
, pythonOlder
|
|
, rapidfuzz
|
|
, rapidfuzz-cpp
|
|
, scikit-build
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "levenshtein";
|
|
version = "0.25.0";
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "maxbachmann";
|
|
repo = "Levenshtein";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-MkzIwTZU8hqPDOlfN4qADCKjGJIQrNhhOmVRAnAfNK0=";
|
|
fetchSubmodules = true; ## for vendored `rapidfuzz-cpp`
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
cython_3
|
|
scikit-build
|
|
];
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
buildInputs = [
|
|
rapidfuzz-cpp
|
|
];
|
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
|
|
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
|
|
]);
|
|
|
|
propagatedBuildInputs = [
|
|
rapidfuzz
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
pytestCheckHook
|
|
];
|
|
|
|
pythonImportsCheck = [
|
|
"Levenshtein"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "Functions for fast computation of Levenshtein distance and string similarity";
|
|
homepage = "https://github.com/maxbachmann/Levenshtein";
|
|
changelog = "https://github.com/maxbachmann/Levenshtein/blob/${src.rev}/HISTORY.md";
|
|
license = licenses.gpl2Plus;
|
|
maintainers = with maintainers; [ fab ];
|
|
};
|
|
}
|