lib-argparse
authorMatthias Klose <doko@debian.org>
Tue, 22 Feb 2022 13:54:07 +0000 (13:54 +0000)
committerMatthias Klose <doko@debian.org>
Tue, 22 Feb 2022 13:54:07 +0000 (13:54 +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 40569437ac62b6155ec5e19d518ce20b6436790f..0324089dee9067361592e8f011f46144c44e7b04 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=='