Skip to content

Replaced distutils build_ext with setuptools#4829

Merged
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:build_ext
Aug 3, 2020
Merged

Replaced distutils build_ext with setuptools#4829
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:build_ext

Conversation

@radarhere
Copy link
Copy Markdown
Member

Helps #4796

Replacing

from distutils.command.build_ext import build_ext

with

from setuptools.command.build_ext import build_ext

At first, trying this fails with

  File "setuptools/command/build_ext.py", line 213, in build_extension
    if ext._needs_stub:
AttributeError: 'Extension' object has no attribute '_needs_stub'

_needs_stub is set in finalize_options() - https://github.com/pypa/setuptools/blob/145a78cdc1afb4ce0c0208ae86a00708eb79d27b/setuptools/command/build_ext.py#L162

So we need to have all Extensions created before running finalize_options. However, we use self.compiler to set some attributes of Extensions, and that isn't set at the time of finalize_options().

Instead, this PR suggests creating all Extensions at the very beginning, and then updating or removing them in build_extensions().

@hugovk hugovk added the Cleanup label Jul 31, 2020
@hugovk hugovk merged commit 0ccb280 into python-pillow:master Aug 3, 2020
@radarhere radarhere deleted the build_ext branch August 3, 2020 10:21
@hugovk hugovk mentioned this pull request Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants