15
0
Files
python-autoflake/fix_standard_paths.patch

42 lines
1.3 KiB
Diff

From d1fe6ad670c890cce5cdbb430a438453da65f015 Mon Sep 17 00:00:00 2001
From: toddrme2178 <toddrme2178@gmail.com>
Date: Tue, 13 Feb 2018 15:39:57 -0500
Subject: [PATCH] standard_paths in plat_specific True and False
Have `standard_paths` look in both platform-specific and platform-independent directories. Fixes issue #32.
---
autoflake.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/autoflake.py b/autoflake.py
index 3918280..8d75dfb 100755
--- a/autoflake.py
+++ b/autoflake.py
@@ -68,16 +68,18 @@
def standard_paths():
"""Yield paths to standard modules."""
- path = distutils.sysconfig.get_python_lib(standard_lib=True)
+ for is_plat_spec in [True, False]:
+ path = distutils.sysconfig.get_python_lib(standard_lib=True,
+ plat_specific=is_plat_spec)
- for name in os.listdir(path):
- yield name
-
- try:
- for name in os.listdir(os.path.join(path, 'lib-dynload')):
+ for name in os.listdir(path):
yield name
- except OSError: # pragma: no cover
- pass
+
+ try:
+ for name in os.listdir(os.path.join(path, 'lib-dynload')):
+ yield name
+ except OSError: # pragma: no cover
+ pass
def standard_package_names():