Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

environment: handle machine file options sections with more than one subproject #14223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions mesonbuild/environment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2012-2020 The Meson development team
# Copyright © 2023 Intel Corporation
# Copyright © 2023-2025 Intel Corporation

from __future__ import annotations

Expand Down Expand Up @@ -718,7 +718,7 @@ def _load_machine_file_options(self, config: 'ConfigParser', properties: Propert

for section, values in config.items():
if ':' in section:
subproject, section = section.split(':')
subproject, section = section.split(':', 1)
else:
subproject = ''
if section == 'built-in options':
Expand All @@ -739,6 +739,13 @@ def _load_machine_file_options(self, config: 'ConfigParser', properties: Propert
if key.subproject:
raise MesonException('Do not set subproject options in [built-in options] section, use [subproject:built-in options] instead.')
self.options[key.evolve(subproject=subproject)] = v
elif ':' in section:
correct_subproject, correct_section = section.split(':')[-2:]
raise MesonException(
'Subproject options should always be set as '
'`[subproject:section]`, even if the options are from a '
'nested subproject. '
f'Replace `[{subproject}:{section}]` with `[{correct_subproject}:{correct_section}]`')

def _set_default_options_from_env(self) -> None:
opts: T.List[T.Tuple[str, str]] = (
Expand Down
Loading