diff --git a/pkgs/data/misc/libkkc-data/default.nix b/pkgs/data/misc/libkkc-data/default.nix index 7fcd2fbf516f..516dd61c60f3 100644 --- a/pkgs/data/misc/libkkc-data/default.nix +++ b/pkgs/data/misc/libkkc-data/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, python2, libkkc }: +{ lib, stdenv, fetchurl, fetchpatch, python3, libkkc }: stdenv.mkDerivation rec { pname = "libkkc-data"; @@ -9,7 +9,16 @@ stdenv.mkDerivation rec { sha256 = "16avb50jasq2f1n9xyziky39dhlnlad0991pisk3s11hl1aqfrwy"; }; - nativeBuildInputs = [ python2.pkgs.marisa ]; + patches = [ + (fetchpatch { + name = "build-python3.patch"; + url = "https://github.com/ueno/libkkc/commit/ba1c1bd3eb86d887fc3689c3142732658071b5f7.patch"; + relative = "data/templates/libkkc-data"; + hash = "sha256-q4zUclJtDQ1E5v2PW00zRZz6GXllLUcp2h3tugufrRU="; + }) + ]; + + nativeBuildInputs = [ python3.pkgs.marisa ]; strictDeps = true; diff --git a/pkgs/development/python-modules/marisa/default.nix b/pkgs/development/python-modules/marisa/default.nix new file mode 100644 index 000000000000..21a457b5b34e --- /dev/null +++ b/pkgs/development/python-modules/marisa/default.nix @@ -0,0 +1,32 @@ +{ lib +, buildPythonPackage +, marisa +, swig +}: + +buildPythonPackage rec { + pname = "marisa"; + inherit (marisa) src version; + + nativeBuildInputs = [ swig ]; + + buildInputs = [ marisa ]; + + preBuild = '' + make -C bindings swig-python + + cd bindings/python + ''; + + # upstream has no tests + doCheck = false; + + pythonImportsCheck = [ "marisa" ]; + + meta = { + description = "Python bindings for marisa"; + homepage = "https://github.com/s-yata/marisa-trie"; + license = with lib.licenses; [ bsd2 lgpl21Plus ]; + maintainers = with lib.maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/tools/inputmethods/libkkc/default.nix b/pkgs/tools/inputmethods/libkkc/default.nix index 0252efa3cdaa..06bc775689f2 100644 --- a/pkgs/tools/inputmethods/libkkc/default.nix +++ b/pkgs/tools/inputmethods/libkkc/default.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, fetchurl -, vala, gobject-introspection, intltool, python2Packages, glib +{ lib, stdenv, fetchurl, fetchpatch +, vala, gobject-introspection, intltool, python3, glib , pkg-config , libgee, json-glib, marisa, libkkc-data }: @@ -13,9 +13,17 @@ stdenv.mkDerivation rec { sha256 = "89b07b042dae5726d306aaa1296d1695cb75c4516f4b4879bc3781fe52f62aef"; }; + patches = [ + (fetchpatch { + name = "build-python3.patch"; + url = "https://github.com/ueno/libkkc/commit/ba1c1bd3eb86d887fc3689c3142732658071b5f7.patch"; + hash = "sha256-4IVpcJJFrxmxJGNiRHteleAa6trOwbvMHRTE/qyjOPY="; + }) + ]; + nativeBuildInputs = [ vala gobject-introspection - python2Packages.python python2Packages.marisa + python3 python3.pkgs.marisa intltool glib pkg-config ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e37a723a121c..8e25b0335c61 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5535,6 +5535,10 @@ self: super: with self; { mariadb = callPackage ../development/python-modules/mariadb { }; + marisa = callPackage ../development/python-modules/marisa { + inherit (pkgs) marisa; + }; + marisa-trie = callPackage ../development/python-modules/marisa-trie { }; markdown2 = callPackage ../development/python-modules/markdown2 { };