diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-02-26 09:34:44 -0800 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-02-27 15:27:42 -0500 |
| commit | 5d648a112fe8ee3bfb637d9db133c05ef3b184b8 (patch) | |
| tree | 38b0eb49574345628a0bc4137378e18833eafeba /mesonbuild/compilers | |
| parent | a7d248d58054b763fd6114d73a0587565a0d1646 (diff) | |
| download | meson-5d648a112fe8ee3bfb637d9db133c05ef3b184b8.tar.gz | |
compilers/detect: Split -beta and -nightly suffixes from rustc
Store both a full version with the nightly and beta suffixes, and the
version as just X.Y.Z. This sort of distinction is why full_version
exists.
This fixes an issue with the bindgen module where we pass invalid
version of X.Y.Z-beta and X.Y.Z-nightly.
Diffstat (limited to 'mesonbuild/compilers')
| -rw-r--r-- | mesonbuild/compilers/detect.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index d4ad4bade..784e00d3d 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -1047,7 +1047,11 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust popen_exceptions[join_args(compiler + arg)] = e continue - version = search_version(out) + # Full version contains the "-nightly" or "-beta" suffixes, but version + # should just be X.Y.Z + full_version = search_version(out) + version = full_version.split('-', 1)[0] + cls: T.Type[RustCompiler] = rust.RustCompiler # Clippy is a wrapper around rustc, but it doesn't have rustc in its @@ -1063,7 +1067,8 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust except OSError as e: popen_exceptions[join_args(compiler + arg)] = e continue - version = search_version(out) + full_version = search_version(out) + version = full_version.split('-', 1)[0] cls = rust.ClippyRustCompiler mlog.deprecation( @@ -1143,7 +1148,7 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust env.coredata.add_lang_args(cls.language, cls, for_machine, env) return cls( compiler, version, for_machine, is_cross, info, - linker=linker) + linker=linker, full_version=full_version) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') |
