1{
2 lib,
3 python,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchzip,
7
8 cmake,
9 cython,
10 numpy,
11 setuptools,
12 setuptools-scm,
13
14 tqdm,
15
16 pytestCheckHook,
17}:
18
19let
20 dic-dirname = "open_jtalk_dic_utf_8-1.11";
21 dic-src = fetchzip {
22 name = dic-dirname;
23 url = "https://github.com/r9y9/open_jtalk/releases/download/v1.11.1/${dic-dirname}.tar.gz";
24 hash = "sha256-+6cHKujNEzmJbpN9Uan6kZKsPdwxRRzT3ZazDnCNi3s=";
25 };
26in
27buildPythonPackage rec {
28 pname = "pyopenjtalk";
29 version = "0.4.1";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "r9y9";
34 repo = "pyopenjtalk";
35 tag = "v${version}";
36 hash = "sha256-f0JNiMCeKpTY+jH3/9LuCkX2DRb9U8sN0SezT6OTm/E=";
37 fetchSubmodules = true;
38 };
39
40 build-system = [
41 cmake
42 cython
43 numpy
44 setuptools
45 setuptools-scm
46 ];
47
48 dontUseCmakeConfigure = true;
49
50 dependencies = [
51 numpy
52 tqdm
53 ];
54
55 postInstall = ''
56 # the package searches for a cached dic directory in this location
57 ln -s ${dic-src} $out/${python.sitePackages}/pyopenjtalk/${dic-dirname}
58 '';
59
60 nativeCheckInputs = [
61 pytestCheckHook
62 ];
63
64 preCheck = ''
65 # the built extension modules are only present in $out
66 # so we make sure to resolve pyopenjtalk from $out
67 rm -r pyopenjtalk
68 '';
69
70 pythonImportsCheck = [ "pyopenjtalk" ];
71
72 meta = {
73 changelog = "https://github.com/r9y9/pyopenjtalk/releases/tag/${src.tag}";
74 description = "Python wrapper for OpenJTalk";
75 homepage = "https://github.com/r9y9/pyopenjtalk";
76 license = lib.licenses.mit;
77 maintainers = with lib.maintainers; [ tomasajt ];
78 };
79}