argparse-no-shutil
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)
Gbp-Pq: Name argparse-no-shutil.diff

Lib/argparse.py

index 0324089dee9067361592e8f011f46144c44e7b04..a916f2e4ba322c5b4bb3cd8205bb5358c39bc271 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