lib-argparse
authorMatthias Klose <doko@debian.org>
Fri, 24 Sep 2021 09:43:00 +0000 (10:43 +0100)
committerMatthias Klose <doko@debian.org>
Fri, 24 Sep 2021 09:43:00 +0000 (10:43 +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 f45a2ed4d4dc77cfacb50dbbc86b9347c88b3df7..b8011ce1c764c240d4c3dae742ae3fda55ddea45 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=='