argparse-no-shutil
authorMatthias Klose <doko@debian.org>
Wed, 8 Jun 2022 09:45:57 +0000 (10:45 +0100)
committerMatthias Klose <doko@debian.org>
Wed, 8 Jun 2022 09:45:57 +0000 (10:45 +0100)
Gbp-Pq: Name argparse-no-shutil.diff

Lib/argparse.py

index 2e23aeeddfa039df9e0c59163b9e278d5d8ddbd8..e5461735f5ccbb14ab1d55f870897a17b44d32e0 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