]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129911: pygettext: Fix the keyword entry in help output (GH-129914)
authorTomas R. <tomas.roun8@gmail.com>
Fri, 14 Feb 2025 09:34:09 +0000 (10:34 +0100)
committerGitHub <noreply@github.com>
Fri, 14 Feb 2025 09:34:09 +0000 (11:34 +0200)
Lib/test/test_tools/test_i18n.py
Misc/NEWS.d/next/Tools-Demos/2025-02-09-20-29-06.gh-issue-129911.uMFtf1.rst [new file with mode: 0644]
Tools/i18n/pygettext.py

index d23479104d438d027ee7f1d0cb837c90e0d3086a..f5aba31ed42c10256f63a8c063664ee2ab69957e 100644 (file)
@@ -413,6 +413,12 @@ class Test_pygettext(unittest.TestCase):
             self.assertIn(f'msgid "{text2}"', data)
             self.assertNotIn(text3, data)
 
+    def test_help_text(self):
+        """Test that the help text is displayed."""
+        res = assert_python_ok(self.script, '--help')
+        self.assertEqual(res.out, b'')
+        self.assertIn(b'pygettext -- Python equivalent of xgettext(1)', res.err)
+
     def test_error_messages(self):
         """Test that pygettext outputs error messages to stderr."""
         stderr = self.get_stderr(dedent('''\
diff --git a/Misc/NEWS.d/next/Tools-Demos/2025-02-09-20-29-06.gh-issue-129911.uMFtf1.rst b/Misc/NEWS.d/next/Tools-Demos/2025-02-09-20-29-06.gh-issue-129911.uMFtf1.rst
new file mode 100644 (file)
index 0000000..1903af7
--- /dev/null
@@ -0,0 +1 @@
+Fix the keyword entry in the help output of :program:`pygettext`.
index 4720aecbdc515accb68e07ed4f41c45b95e79b3a..4177d46048f9b9ea2a631c4f40084d362342d4e4 100755 (executable)
@@ -67,7 +67,8 @@ Options:
     -k word
     --keyword=word
         Keywords to look for in addition to the default set, which are:
-        %(DEFAULTKEYWORDS)s
+        _, gettext, ngettext, pgettext, npgettext, dgettext, dngettext,
+        dpgettext, and dnpgettext.
 
         You can have multiple -k flags on the command line.
 
@@ -169,7 +170,7 @@ msgstr ""
 
 
 def usage(code, msg=''):
-    print(__doc__ % globals(), file=sys.stderr)
+    print(__doc__, file=sys.stderr)
     if msg:
         print(msg, file=sys.stderr)
     sys.exit(code)