nixpkgs/pkgs/development/python-modules/gruut/default.nix

75 lines
1.3 KiB
Nix
Raw Normal View History

2021-07-03 19:30:55 +00:00
{ lib
, buildPythonPackage
, callPackage
, pythonOlder
, fetchFromGitHub
, Babel
, gruut-ipa
, jsonlines
, num2words
, python-crfsuite
, dataclasses
, python
}:
let
langPkgs = [
"cs"
"de"
"es"
"fr"
"it"
"nl"
"pt"
"ru"
"sv"
"sw"
];
in
buildPythonPackage rec {
pname = "gruut";
2021-07-15 20:33:03 +00:00
version = "1.2.3";
2021-07-03 19:30:55 +00:00
format = "setuptools";
src = fetchFromGitHub {
owner = "rhasspy";
repo = pname;
rev = "v${version}";
2021-07-15 20:33:03 +00:00
sha256 = "sha256-qY4xsoVk1hyY9dYmVXaqDRjcShUQmp8VZOzAQNiC6EM=";
2021-07-03 19:30:55 +00:00
};
postPatch = ''
substituteInPlace requirements.txt \
--replace "Babel~=2.8.0" "Babel"
'';
propagatedBuildInputs = [
Babel
gruut-ipa
jsonlines
num2words
python-crfsuite
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
] ++ (map (lang: callPackage ./language-pack.nix {
inherit lang version format src;
}) langPkgs);
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [
"gruut"
];
meta = with lib; {
description = "A tokenizer, text cleaner, and phonemizer for many human languages";
homepage = "https://github.com/rhasspy/gruut";
license = licenses.mit;
maintainers = teams.tts.members;
};
}