argparse-no-shutil
authorMatthias Klose <doko@debian.org>
Sun, 10 Jan 2021 15:42:50 +0000 (15:42 +0000)
committerMatthias Klose <doko@debian.org>
Sun, 10 Jan 2021 15:42:50 +0000 (15:42 +0000)
Gbp-Pq: Name argparse-no-shutil.diff

Lib/argparse.py

index 840d3b11624dd212274ccd09a687d568529ecd7b..45e3b46090a394c14a5d6c7c0dfd6ffc2e3e0cf7 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