diff --git a/pkgs/development/python-modules/marisa-trie/default.nix b/pkgs/development/python-modules/marisa-trie/default.nix index 43fdeb62c572..df7746784847 100644 --- a/pkgs/development/python-modules/marisa-trie/default.nix +++ b/pkgs/development/python-modules/marisa-trie/default.nix @@ -2,6 +2,8 @@ lib, buildPythonPackage, fetchPypi, + replaceVars, + marisa-cpp, cython, setuptools, pytestCheckHook, @@ -23,22 +25,27 @@ buildPythonPackage rec { hash = "sha256-OifECOKu/APg8dJbL/KvuFqsNWj2+iripTtXouh84p0="; }; + patches = [ + (replaceVars ./unvendor-marisa.patch { + marisa = lib.getDev marisa-cpp; + }) + ]; + build-system = [ cython setuptools ]; + buildInputs = [ + marisa-cpp + ]; + nativeCheckInputs = [ pytestCheckHook readme-renderer hypothesis ]; - postPatch = '' - substituteInPlace setup.py \ - --replace "hypothesis==" "hypothesis>=" - ''; - preBuild = '' ./update_cpp.sh ''; diff --git a/pkgs/development/python-modules/marisa-trie/unvendor-marisa.patch b/pkgs/development/python-modules/marisa-trie/unvendor-marisa.patch new file mode 100644 index 000000000000..26ac8156a06b --- /dev/null +++ b/pkgs/development/python-modules/marisa-trie/unvendor-marisa.patch @@ -0,0 +1,30 @@ +diff --git a/setup.py b/setup.py +index c0c5c03..6373a2a 100755 +--- a/setup.py ++++ b/setup.py +@@ -71,15 +71,6 @@ setup( + license=LICENSE, + url="https://github.com/pytries/marisa-trie", + classifiers=CLASSIFIERS, +- libraries=[ +- ( +- "libmarisa-trie", +- { +- "sources": MARISA_FILES, +- "include_dirs": [MARISA_SOURCE_DIR, MARISA_INCLUDE_DIR], +- }, +- ) +- ], + ext_modules=[ + Extension( + "marisa_trie", +@@ -94,7 +85,8 @@ setup( + "src/std_iostream.cpp", + "src/trie.cpp", + ], +- include_dirs=[MARISA_INCLUDE_DIR], ++ include_dirs=["@marisa@/include"], ++ libraries=["marisa"], + ) + ], + python_requires=">=3.8", diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index db00c2c12939..d4d60bb0f41f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8539,7 +8539,9 @@ self: super: with self; { marisa = callPackage ../development/python-modules/marisa { inherit (pkgs) marisa; }; - marisa-trie = callPackage ../development/python-modules/marisa-trie { }; + marisa-trie = callPackage ../development/python-modules/marisa-trie { + marisa-cpp = pkgs.marisa; + }; markdown = callPackage ../development/python-modules/markdown { };