summaryrefslogtreecommitdiff
path: root/mesonbuild/mconf.py
AgeCommit message (Collapse)Author
2025-10-29coredata: move cmd_line.txt and command line handling to a new modulePaolo Bonzini
cmd_line.txt is not related to serialized data, in fact it's a fallback for when serialized data cannot be used and is also related to setting up argparse for command line parsing. Since there is no code in common with the rest of coredata, move it to a new module. Fixes: #15081 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-07-17options: parse -D and -U arguments directly into a Dict[OptionKey, ↵Paolo Bonzini
Optional[str]] As a side effect, this deduplicates -D and -U arguments passed to meson configure, taking into account the relative ordering of -D and -U options. Fixes: #14754 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-07-14mconf: print build option names including "build."Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-20mconf: print overrides specific to the main projectPaolo Bonzini
Those were hidden, because the global options look at subproject `None` rather than `''`. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-20mconf: print sections lazilyPaolo Bonzini
To the user, toplevel project options are the same as global options because they are not prefixed by ":". So, even if we starting printing toplevel project overrides, we want to keep project options outside of that section. Then one would end up with: ... Project options --------------- Main project: Subproject foo: The "Main project" line is printed because '' is in self.all_subprojects, but there is nothing below because project options have been printed before. To fix this, print section names lazily, together with their first content item. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-20mconf: print global compiler optionsPaolo Bonzini
Fixes: #14476 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15mconf: extract option processing to CoreData.set_from_configure_commandPaolo Bonzini
Prepare to reuse the logic in "meson setup --reconfigure". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15mconf: remove dead functionPaolo Bonzini
This was the pre-refactoring implementation of `-D`, which is now unused. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07options: store augments as OptionKeysPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-08coredata: move update_project_options to the optstoreDylan Baker
2025-04-08coredata: move MutableKeyedOptionDict to optionsDylan Baker
2025-03-04coredata: delete a bunch of unused methodsDylan Baker
Added by the optionrefactor changes, but not used
2025-02-27coredata: delete the OptionsViewDylan Baker
This also makes KeyedOptionDictType obsolete and it's removed
2025-02-13Make all Meson level options overridable per subproject.Jussi Pakkanen
2025-02-05options: Replace uses of `UserOption[T.Any]` with a Union of UserOption typesDylan Baker
The fact that UserOption is generic is really an implementation detail, not something to be used publicly. So by having an `AnyOptionType` alias, we can get better type checking, as can be seen by the patch as a whole. One of the big fixes it replace open-coded equivlalents of `MutableKeydOptionDictType` with that type alias.
2025-02-05options: Add an EnumeratedUserOption classDylan Baker
This will allow us to take choices out of the UserOption class, which doesn't actually use this attribute.
2024-09-14Fix various incorrect uses of `its` vs `it's`.Andrew McNulty
These errors can make reading comments and documentation unnecessarily confusing for users and contributors who do not speak English as their first language.
2024-07-17Remove module type from OptionKey.Jussi Pakkanen
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2024-07-11Move compiler option check into OptionStore.Jussi Pakkanen
2024-07-11Move builtin option check into OptionStore.Jussi Pakkanen
2024-07-11Move backend option check into OptionStore.Jussi Pakkanen
2024-07-11Move base option check into OptionStore.Jussi Pakkanen
2024-07-11Move project option detection into OptionStore.Jussi Pakkanen
2024-06-14Fix mypy.Jussi Pakkanen
2024-06-14Replace direct indexing with named methods.Jussi Pakkanen
2024-06-14Rename option variable to optstore to make it unique.Jussi Pakkanen
2024-05-23Refactor option classes to their own file.Jussi Pakkanen
2024-03-18mconf: Reload the options files if they have changedDylan Baker
This fixes issues where a new option is added, an option is removed, the constraints of an option are changed, an option file is added where one didn't previously exist, an option file is deleted, or it is renamed between meson_options.txt and meson.options There is one case that is known to not work, but it's probably a less common case, which is setting options for an unconfigured subproject. We could probably make that work in some cases, but I don't think it makes sense to download a wrap during meson configure.
2024-02-23mconf|msetup: use Protocol for argparse optionsDylan Baker
These are much easier to handle as one commit since msetup calls mconf internally. This has found one case where things are being carefully crafted to work in mconf even though msetup has slightly different options
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott
line argument code
2023-08-25msetup: Update options when builddir is already configuredXavier Claessens
`meson setup -Dfoo=bar builddir` command was returning success ignoring new option values. This now also update options. It is useful because it means `meson setup -Dfoo=bar builddir && ninja -C builddir` works regardless whether builddir already exists or not, and when done in a script, changing options in the script will automatically trigger a reconfigure if needed. This was already possible by always passing --reconfigure argument, but that triggers a reconfigure even when options did not change.
2023-07-19fix implicit_reexport issues and enforce them going forwardEli Schwartz
This detects cases where module A imports a function from B, and C imports that same function from A instead of B. It's not part of the API contract of A, and causes innocent refactoring to break things.
2023-06-25fully type mconf.pyEli Schwartz
2023-06-23coredata: Also clear compiler and run cachesXavier Claessens
2023-06-23mconf: Allow changing options and clearing cache at the same timeXavier Claessens
Setting options or clearing cache is also an error without a valid build directory.
2023-05-31mlog: use a hidden class for stateDylan Baker
This is a pretty common pattern in python (the standard library uses it a ton): A class is created, with a single private instance in the module, and then it's methods are exposed as public API. This removes the need for the global statement, and is generally a little easier to reason about thanks to encapsulation.
2023-03-16coredata: Do not pickle it twiceXavier Claessens
Exclude coredata from build.dat because it gets pickled separately already.
2023-03-16Stop using replace_if_different() for coredata pickle fileDaan De Meyer
This was added in f774609 to only change the access time of the coredata file if the coredata struct actually changed. However, this doesn't work as pickle serializations aren't guaranteed to be stable. Instead, let's manually check if options have changed values and skip the save if they haven't changed. We also extend the associated unit test to cover all the option types and to ensure that configure does get executed if one of the options changes value.
2023-02-07mconf: Use auto_features value for auto optionsXavier Claessens
When project is configured with -Dauto_features=disabled, meson configure should not print "auto" value but "disabled" instead.
2023-02-01treewide: add future annotations importEli Schwartz
2022-09-27mconf: Do not print None for empty choicesXavier Claessens
2022-09-27mconf: Use pager only when printing configurationXavier Claessens
Fixes: #10845
2022-09-22mconf: Add --no-pager optionXavier Claessens
2022-09-22mconf: Print options with colorsXavier Claessens
2022-09-22mconf: Substract the 3 space separators between columnsXavier Claessens
2022-09-22mconf: Do not wrap choices manuallyXavier Claessens
We already use textwrap.wrap() for that and it will correctly split on spaces.
2022-09-22mconf: There is always 4 columnsXavier Claessens
2022-09-22mlog: Add support for pagerXavier Claessens
It is useful to redirect some outputs, such as "meson configure" to a pager (e.h. less). This is similar to most git commands.