lib-argparse
authorMatthias Klose <doko@debian.org>
Thu, 24 Mar 2022 13:02:21 +0000 (13:02 +0000)
committerMatthias Klose <doko@debian.org>
Thu, 24 Mar 2022 13:02:21 +0000 (13:02 +0000)
# DP: argparse.py: Make the gettext import conditional

# DP: argparse.py: Make the gettext import conditional

Gbp-Pq: Name lib-argparse.diff

Lib/argparse.py

index c46bb302711fc5c9eca3c8c7b667f4d600fe3ae7..08008dacb526e35f596838879464541955e985e0 100644 (file)
@@ -89,7 +89,16 @@ import os as _os
 import re as _re
 import sys as _sys
 
-from gettext import gettext as _, ngettext
+try:
+    from gettext import gettext as _, ngettext
+except ImportError:
+    def _(message):
+        return message
+    def ngettext(singular,plural,n):
+        if n == 1:
+            return singular
+        else:
+            return plural
 
 SUPPRESS = '==SUPPRESS=='