Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6268669

Browse files
committed
Patch #411055 from MvL: import each extension after building it, and
delete ones that can't be imported due to missing symbols or other causes.
1 parent 185bd6f commit 6268669

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ def build_extension(self, ext):
130130
except (CCompilerError, DistutilsError), why:
131131
self.announce('WARNING: building of extension "%s" failed: %s' %
132132
(ext.name, sys.exc_info()[1]))
133+
return
134+
try:
135+
__import__(ext.name)
136+
except ImportError:
137+
self.announce('WARNING: removing "%s" since importing it failed' %
138+
ext.name)
139+
assert not self.inplace
140+
fullname = self.get_ext_fullname(ext.name)
141+
ext_filename = os.path.join(self.build_lib,
142+
self.get_ext_filename(fullname))
143+
os.remove(ext_filename)
133144

134145
def get_platform (self):
135146
# Get value of sys.platform
@@ -602,6 +613,9 @@ def initialize_options (self):
602613
self.warn_dir=0
603614

604615
def main():
616+
# turn off warnings when deprecated modules are imported
617+
import warnings
618+
warnings.filterwarnings("ignore",category=DeprecationWarning)
605619
setup(name = 'Python standard library',
606620
version = '%d.%d' % sys.version_info[:2],
607621
cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall},

0 commit comments

Comments
 (0)