7e47f3658e
GitOrigin-RevId: 1925c603f17fc89f4c8f6bf6f631a802ad85d784
96 lines
1.9 KiB
Nix
96 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
pythonOlder,
|
|
fetchFromGitHub,
|
|
cmake,
|
|
cython,
|
|
ninja,
|
|
scikit-build,
|
|
setuptools,
|
|
numpy,
|
|
hypothesis,
|
|
pandas,
|
|
pytestCheckHook,
|
|
rapidfuzz-cpp,
|
|
taskflow,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "rapidfuzz";
|
|
version = "3.9.7";
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "maxbachmann";
|
|
repo = "RapidFuzz";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-hyjzY9ogroUa4nGSG8HOyr5FxifX9d7Hf8ezKq6zxVk=";
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace pyproject.toml \
|
|
--replace-fail "scikit-build~=0.18.0" "scikit-build" \
|
|
--replace-fail "Cython >=3.0.11, <3.1.0" "Cython"
|
|
'';
|
|
|
|
build-system = [
|
|
cmake
|
|
cython
|
|
ninja
|
|
scikit-build
|
|
setuptools
|
|
];
|
|
|
|
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"
|
|
'';
|
|
|
|
passthru.optional-dependencies = {
|
|
full = [ 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 ];
|
|
};
|
|
}
|