lib-argparse
authorMatthias Klose <doko@debian.org>
Wed, 8 Jun 2022 09:45:57 +0000 (10:45 +0100)
committerMatthias Klose <doko@debian.org>
Wed, 8 Jun 2022 09:45:57 +0000 (10:45 +0100)
# 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 b9c22051f69d75a82c9fab1dd7a8a9fb7f9cd43f..2e23aeeddfa039df9e0c59163b9e278d5d8ddbd8 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=='