Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at domenkozar-patch-1 87 lines 1.7 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, pythonOlder 5, fetchFromGitHub 6, cmake 7, cython_3 8, ninja 9, scikit-build 10, setuptools 11, numpy 12, hypothesis 13, pandas 14, pytestCheckHook 15, rapidfuzz-cpp 16, taskflow 17}: 18 19buildPythonPackage rec { 20 pname = "rapidfuzz"; 21 version = "2.13.7"; 22 23 disabled = pythonOlder "3.7"; 24 25 format = "pyproject"; 26 27 src = fetchFromGitHub { 28 owner = "maxbachmann"; 29 repo = "RapidFuzz"; 30 rev = "refs/tags/v${version}"; 31 hash = "sha256-ZovXYOoLriAmJHptolD135qCn7XHeVvzLJNzI08mqwY="; 32 }; 33 34 nativeBuildInputs = [ 35 cmake 36 cython_3 37 ninja 38 scikit-build 39 setuptools 40 ]; 41 42 dontUseCmakeConfigure = true; 43 44 buildInputs = [ 45 rapidfuzz-cpp 46 taskflow 47 ]; 48 49 preBuild = '' 50 export RAPIDFUZZ_BUILD_EXTENSION=1 51 '' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) '' 52 export CMAKE_ARGS="-DCMAKE_CXX_COMPILER_AR=$AR -DCMAKE_CXX_COMPILER_RANLIB=$RANLIB" 53 ''; 54 55 NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [ 56 "-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098 57 ]; 58 59 propagatedBuildInputs = [ 60 numpy 61 ]; 62 63 preCheck = '' 64 export RAPIDFUZZ_IMPLEMENTATION=cpp 65 ''; 66 67 checkInputs = [ 68 hypothesis 69 pandas 70 pytestCheckHook 71 ]; 72 73 pythonImportsCheck = [ 74 "rapidfuzz.fuzz" 75 "rapidfuzz.string_metric" 76 "rapidfuzz.process" 77 "rapidfuzz.utils" 78 ]; 79 80 meta = with lib; { 81 description = "Rapid fuzzy string matching"; 82 homepage = "https://github.com/maxbachmann/RapidFuzz"; 83 changelog = "https://github.com/maxbachmann/RapidFuzz/blob/${src.rev}/CHANGELOG.rst"; 84 license = licenses.mit; 85 maintainers = with maintainers; [ dotlambda ]; 86 }; 87}