From 601d2933764f33a689679a583a08393c35b641e5 Mon Sep 17 00:00:00 2001 From: Kerstin Humm Date: Mon, 22 Jul 2024 17:09:40 +0200 Subject: [PATCH] python3Packages.translation-finder: init at 2.16 --- .../translation-finder/default.nix | 40 +++++++++++++++++++ .../translation-finder/fix_tests.patch | 25 ++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 67 insertions(+) create mode 100644 pkgs/development/python-modules/translation-finder/default.nix create mode 100644 pkgs/development/python-modules/translation-finder/fix_tests.patch diff --git a/pkgs/development/python-modules/translation-finder/default.nix b/pkgs/development/python-modules/translation-finder/default.nix new file mode 100644 index 000000000000..c31c76413646 --- /dev/null +++ b/pkgs/development/python-modules/translation-finder/default.nix @@ -0,0 +1,40 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + charset-normalizer, + ruamel-yaml, + weblate-language-data, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "translation-finder"; + version = "2.16"; + + src = fetchPypi { + pname = "translation-finder"; + inherit version; + hash = "sha256-a1C+j4Zo0DJ9BWDn5Zsu4zAftcUixfPktAWdqiFJpiU="; + }; + + patches = [ ./fix_tests.patch ]; + + dependencies = [ + charset-normalizer + ruamel-yaml + weblate-language-data + ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + pythonImportsCheck = [ "translation_finder" ]; + + meta = with lib; { + description = "Translation file finder for Weblate"; + homepage = "https://github.com/WeblateOrg/translation-finder"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ erictapen ]; + }; + +} diff --git a/pkgs/development/python-modules/translation-finder/fix_tests.patch b/pkgs/development/python-modules/translation-finder/fix_tests.patch new file mode 100644 index 000000000000..caf748a77130 --- /dev/null +++ b/pkgs/development/python-modules/translation-finder/fix_tests.patch @@ -0,0 +1,25 @@ +diff --git a/translation_finder/test_api.py b/translation_finder/test_api.py +index c3b020c..9be070d 100644 +--- a/translation_finder/test_api.py ++++ b/translation_finder/test_api.py +@@ -173,6 +173,7 @@ class APITest(DiscoveryTestCase): + "filemask": "json/gotext-*.json", + "template": "json/gotext-en.json", + }, ++ {'filemask': 'linked/*.po', 'new_base': 'linked/messages.pot', 'file_format': 'po'}, + ], + ) + +diff --git a/translation_finder/test_discovery.py b/translation_finder/test_discovery.py +index 1a0ca40..14caa4f 100644 +--- a/translation_finder/test_discovery.py ++++ b/translation_finder/test_discovery.py +@@ -945,6 +945,9 @@ class JSONDiscoveryTest(DiscoveryTestCase): + "file_format": "json-nested", + "template": "src/app/[locale]/_translations/en.json", + }, ++ {'filemask': '*/app/[locale]/_translations/cs.json', 'file_format': 'json-nested'}, ++ {'filemask': '*/app/[locale]/_translations/de.json', 'file_format': 'json-nested'}, ++ {'filemask': '*/app/[locale]/_translations/en.json', 'file_format': 'json-nested'} + ], + ) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index eb361c65b45a..4b610e7c7013 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15813,6 +15813,8 @@ self: super: with self; { translate-toolkit = callPackage ../development/python-modules/translate-toolkit { }; + translation-finder = callPackage ../development/python-modules/translation-finder { }; + trackpy = callPackage ../development/python-modules/trackpy { }; trafilatura = callPackage ../development/python-modules/trafilatura { };