1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonOlder,
7}:
8
9buildPythonPackage rec {
10 pname = "pypinyin";
11 version = "0.54.0";
12 format = "setuptools";
13
14 disabled = pythonOlder "3.7";
15
16 src = fetchFromGitHub {
17 owner = "mozillazg";
18 repo = "python-pinyin";
19 tag = "v${version}";
20 hash = "sha256-kA6h2CPGhoZt8h3KEttegHhmMqVc72IkrkA3PonY3sY=";
21 };
22
23 postPatch = ''
24 substituteInPlace pytest.ini --replace \
25 "--cov-report term-missing" ""
26 '';
27
28 nativeCheckInputs = [ pytestCheckHook ];
29
30 pytestFlagsArray = [ "tests" ];
31
32 meta = with lib; {
33 description = "Chinese Characters to Pinyin - 汉字转拼音";
34 mainProgram = "pypinyin";
35 homepage = "https://github.com/mozillazg/python-pinyin";
36 changelog = "https://github.com/mozillazg/python-pinyin/blob/${src.tag}/CHANGELOG.rst";
37 license = licenses.mit;
38 teams = [ teams.tts ];
39 };
40}