ae2dc6aea6
GitOrigin-RevId: 4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0
104 lines
2.1 KiB
Nix
104 lines
2.1 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
pythonOlder,
|
|
fetchFromGitHub,
|
|
fetchpatch2,
|
|
cmake,
|
|
cython,
|
|
ninja,
|
|
scikit-build-core,
|
|
setuptools,
|
|
numpy,
|
|
hypothesis,
|
|
pandas,
|
|
pytestCheckHook,
|
|
rapidfuzz-cpp,
|
|
taskflow,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "rapidfuzz";
|
|
version = "3.10.0";
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.9";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "maxbachmann";
|
|
repo = "RapidFuzz";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-hLYidU09nCSOi42zgSh7dW83glxIjFY4C6BTmy/sf60=";
|
|
};
|
|
|
|
patches = [
|
|
# https://github.com/rapidfuzz/RapidFuzz/pull/414
|
|
(fetchpatch2 {
|
|
name = "support-taskflow-3.8.0.patch";
|
|
url = "https://github.com/rapidfuzz/RapidFuzz/commit/8f0429bbd970ccc036018b87108845c384911ff7.patch";
|
|
hash = "sha256-1wizdCkXYEMe5JWXUHCOCuDdS0z76FKimR47B3s2oVU=";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace pyproject.toml \
|
|
--replace-fail "Cython >=3.0.11, <3.1.0" "Cython"
|
|
'';
|
|
|
|
build-system = [
|
|
cmake
|
|
cython
|
|
ninja
|
|
scikit-build-core
|
|
];
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
buildInputs = [
|
|
rapidfuzz-cpp
|
|
taskflow
|
|
];
|
|
|
|
preBuild =
|
|
''
|
|
export RAPIDFUZZ_BUILD_EXTENSION=1
|
|
''
|
|
+ lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
|
|
export CMAKE_ARGS="-DCMAKE_CXX_COMPILER_AR=$AR -DCMAKE_CXX_COMPILER_RANLIB=$RANLIB"
|
|
'';
|
|
|
|
optional-dependencies = {
|
|
all = [ numpy ];
|
|
};
|
|
|
|
preCheck = ''
|
|
export RAPIDFUZZ_IMPLEMENTATION=cpp
|
|
'';
|
|
|
|
nativeCheckInputs = [
|
|
hypothesis
|
|
pandas
|
|
pytestCheckHook
|
|
];
|
|
|
|
disabledTests = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
|
|
# segfaults
|
|
"test_cdist"
|
|
];
|
|
|
|
pythonImportsCheck = [
|
|
"rapidfuzz.distance"
|
|
"rapidfuzz.fuzz"
|
|
"rapidfuzz.process"
|
|
"rapidfuzz.utils"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "Rapid fuzzy string matching";
|
|
homepage = "https://github.com/maxbachmann/RapidFuzz";
|
|
changelog = "https://github.com/maxbachmann/RapidFuzz/blob/${src.rev}/CHANGELOG.rst";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
};
|
|
}
|