diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-07-12 13:30:35 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-07-12 15:56:51 -0400 |
commit | e2ce53b6b48091196d125be671a8453896b8275a (patch) | |
tree | 72eb1a9c15b86f5cc14cfea8cdeea7bc09d295c7 /mesonbuild | |
parent | 2c1e2b680e91ec630058cfb43fa265872d28879c (diff) | |
download | meson-e2ce53b6b48091196d125be671a8453896b8275a.zip meson-e2ce53b6b48091196d125be671a8453896b8275a.tar.gz meson-e2ce53b6b48091196d125be671a8453896b8275a.tar.bz2 |
compilers: detect cython version on stdout for newer cython versions
Cython historically, when asked to print the version and exit
successfully, would do so on stderr, which is weird and inconsistent.
Recently, it fixed this UX bug by printing on stdout instead:
https://github.com/cython/cython/issues/5504
This then broke meson detection because we assumed it was on stderr due
to historically being there:
https://github.com/scipy/scipy/issues/18865
Cython is right, and shouldn't have to revert this reasonable change for
backwards compatibility. Instead, check both.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/detect.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 5ac19c9..210ec4d 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -927,13 +927,19 @@ def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Co popen_exceptions: T.Dict[str, Exception] = {} for comp in compilers: try: - err = Popen_safe_logged(comp + ['-V'], msg='Detecting compiler via')[2] + _, out, err = Popen_safe_logged(comp + ['-V'], msg='Detecting compiler via') except OSError as e: popen_exceptions[join_args(comp + ['-V'])] = e continue - version = search_version(err) - if 'Cython' in err: + version: T.Optional[str] = None + # 3.0 + if 'Cython' in out: + version = search_version(out) + # older + elif 'Cython' in err: + version = search_version(err) + if version is not None: comp_class = CythonCompiler env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) return comp_class([], comp, version, for_machine, info, is_cross=is_cross) |