argparse-no-shutil
authorMatthias Klose <doko@debian.org>
Thu, 17 Mar 2022 07:20:01 +0000 (07:20 +0000)
committerMatthias Klose <doko@debian.org>
Thu, 17 Mar 2022 07:20:01 +0000 (07:20 +0000)
Gbp-Pq: Name argparse-no-shutil.diff

Lib/argparse.py

index d022c50adaa62b88b7216cb07a4a0692c1208eda..40792f6bd1b79ba98c4d747a7368159acb8688a1 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