Skip to content

Add --preset-vars-file to build-script for easier preset vars handling #76058

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

Merged
merged 1 commit into from
Aug 27, 2024
Merged
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
14 changes: 14 additions & 0 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ def parse_preset_args():
help="list all presets and exit",
action=argparse.actions.StoreTrueAction,
nargs=argparse.Nargs.OPTIONAL)
parser.add_argument(
"--preset-vars-file",
help="load preset vars from the specified file",
metavar="PATH",
action="append",
dest="preset_vars_file_names",
default=[])
parser.add_argument(
"--distcc",
help="use distcc",
Expand Down Expand Up @@ -589,6 +596,13 @@ def main_preset():
fatal_error("missing --preset option")

args.preset_substitutions = {}
for file in args.preset_vars_file_names:
if os.path.isfile(file):
with open(file, 'r') as f:
for _, line in enumerate(f):
name, value = line.split("=", 1)
args.preset_substitutions[name] = value

for arg in args.preset_substitutions_raw:
name, value = arg.split("=", 1)
args.preset_substitutions[name] = value
Expand Down