summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-04-30 15:06:16 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-04-30 15:06:16 (GMT)
commit5c2ac8c1c664d17924157ed769a7541c9228a1e3 (patch)
treef17783f65c3e952a499195570703822502951662 /setup.py
parent30a6df5b64928c47cb8e7c227ef4adeb30a7162f (diff)
downloadcpython-5c2ac8c1c664d17924157ed769a7541c9228a1e3.zip
cpython-5c2ac8c1c664d17924157ed769a7541c9228a1e3.tar.gz
cpython-5c2ac8c1c664d17924157ed769a7541c9228a1e3.tar.bz2
setup.py: report modules which built but import failed (closes #21282)
Patch by Lukas Vacek.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index c0bb513..e6b4d51 100644
--- a/setup.py
+++ b/setup.py
@@ -167,6 +167,7 @@ class PyBuildExt(build_ext):
def __init__(self, dist):
build_ext.__init__(self, dist)
self.failed = []
+ self.failed_on_import = []
def build_extensions(self):
@@ -247,8 +248,9 @@ class PyBuildExt(build_ext):
build_ext.build_extensions(self)
longest = max([len(e.name) for e in self.extensions])
- if self.failed:
- longest = max(longest, max([len(name) for name in self.failed]))
+ if self.failed or self.failed_on_import:
+ all_failed = self.failed + self.failed_on_import
+ longest = max(longest, max([len(name) for name in all_failed]))
def print_three_column(lst):
lst.sort(key=str.lower)
@@ -276,6 +278,14 @@ class PyBuildExt(build_ext):
print_three_column(failed)
print()
+ if self.failed_on_import:
+ failed = self.failed_on_import[:]
+ print()
+ print("Following modules built successfully"
+ " but were removed because they could not be imported:")
+ print_three_column(failed)
+ print()
+
def build_extension(self, ext):
if ext.name == '_ctypes':
@@ -334,7 +344,7 @@ class PyBuildExt(build_ext):
try:
importlib._bootstrap._SpecMethods(spec).load()
except ImportError as why:
- self.failed.append(ext.name)
+ self.failed_on_import.append(ext.name)
self.announce('*** WARNING: renaming "%s" since importing it'
' failed: %s' % (ext.name, why), level=3)
assert not self.inplace