lib-argparse
authorMatthias Klose <doko@debian.org>
Tue, 8 Dec 2020 07:51:42 +0000 (07:51 +0000)
committerMatthias Klose <doko@debian.org>
Tue, 8 Dec 2020 07:51:42 +0000 (07:51 +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 2fb1da59f942cff7fbfc136ebd08ee8ec14bcbaa..840d3b11624dd212274ccd09a687d568529ecd7b 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=='