argparse-no-shutil
authorMatthias Klose <doko@debian.org>
Tue, 21 Dec 2021 19:12:12 +0000 (19:12 +0000)
committerRaspbian forward porter <root@raspbian.org>
Tue, 21 Dec 2021 19:12:12 +0000 (19:12 +0000)
Gbp-Pq: Name argparse-no-shutil.diff

Lib/argparse.py

index cc4553d09ff9a421e62160259a58af431dd1355b..df6404767b8a997ff883af38f96ec724ec663301 100644 (file)
@@ -175,9 +175,12 @@ class HelpFormatter(object):
 
         # default setting for width
         if width is None:
-            import shutil
-            width = shutil.get_terminal_size().columns
-            width -= 2
+            try:
+                import shutil as _shutil
+                width = _shutil.get_terminal_size().columns
+                width -= 2
+            except ImportError:
+                width = 70
 
         self._prog = prog
         self._indent_increment = indent_increment