Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This moves several of the operations that were performed at module-level in the
setup.py
into a subclass of the distutilsbuild_ext
command. This way, operations that are only relevant to building extension modules are only performed when actually building extension modules, rather than unconditionally.This allows certain operations like
./setup.py --name
and./setup.py --version
to work without unnecessary side-effects.One possible small regression this introduces is that if you want the Cython-generated C sources to be included in a source distribution it's now necessary to run
./setup.py build_ext sdist
, rather than./setup.py sdist
, though we could also make it so thatbuild_ext
is run automatically as a prerequisite ofsdist
. That said, I'm not sure if this is really desirable in this case, since the Cython compilation depends on someDEF
statements, which in turn depend on external values.