envconfig: read CYTHON from the environment and use it if set #12674
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.
Add support for specifying Cython compiler using the
CYTHON
environment variable. If not set, proceed with the names hard coded for Cython. Inspired by issue #1645, which ended up with this solution being implemented forVALAC
(bc30ad6).There is already a line in the existing code that reads the
CYTHON
variable, but only in test code.Motivation: MacPorts uses versioned names (e.g.,
cython-3.12
) and so does not exposecython
orcython3
by default (there is a command to create symlinks tocython
/cython3
). Its NumPy package is currently built by patching NumPy’s bundled version of Meson to use the solution I am proposing here, and that is also where I got the idea from.Note: I read that these environment variables are deprecated and that environment variables in Meson generally should be “avoided whenever possible”, but as far as I could see there is no new solution in place yet?
Edit:
I should add that
cython-3.12
itself is a symlink to thecython
binary, but it resides in a folder that is not on PATH. This is deliberate, so that different Python versions can live side by side.