summaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/base.py
AgeCommit message (Collapse)Author
2025-12-22dependencies: make arguments to InternalDependency.__init__ optionalPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-17dependencies: Remove `log_tried` methodDylan Baker
It's now only used to populate the DependencyCandidate, so we can remove it and just calculate the same information from the `type_name` parameter. This reduces code and the number of method calls.
2025-12-17dependencies: Add a wrapper class for Dependency candidatesDylan Baker
The goal is to have a single type for candidates that replaces having a mixture of class initializers, partials, and factories with a single wrapper class.
2025-12-17dependencies: Require 'native' be passed in kwargsDylan Baker
This simplifies a bunch of cases, and likely fixes some annoying bugs in cross compile situations where should have been passing this and weren't.
2025-12-17dependencies: stop passing "language" as a keyword argumentDylan Baker
It's allowed in the `DependencyKeywordArguments` TypeDict already, so we now have two sources of truth. Additionally, it's often populated by reading from that dict, so we're just doing useless work.
2025-12-17dependencies: Pass the `name` to `ExternalDependency` constructorDylan Baker
So we don't create a default name that is overwritten except in the case of appleframeworks. This allows for some cleanup, including deleting some initializers that were only setting the name.
2025-12-17dependencies: Move type_name to class levelDylan Baker
This is really class constant for all dependencies, and by taking it out of the initializer we make the `__init__` call have a more consistent interface.
2025-11-19compilers: Remove Environment parameter from Compiler.sanity_checkDylan Baker
2025-10-31dependencies: remove copy of self.libtype being setDylan Baker
This is a clear copy-n-paste or rebase error on my part.
2025-10-20dependencies: Add remaining internal arguments to Dependency classesDylan Baker
These may be better replaced by setting instance attributes, honestly.
2025-10-20dependencies: Add `silent` to known keyword arguments to DependencyDylan Baker
2025-10-20modules/python: port dependency embed to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency version to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency static to typed_kwargsDylan Baker
Static must be optional, because although the default is static=false, we special case that static : false is different than static being not set in a number of cases.
2025-10-20interpreter: port dependency required to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency private_headers to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency optional_modules to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency native to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency modules to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency method to typed_kwargsDylan Baker
This allows us a bunch of nice things: 1. We can use the DependencyMethods enum everywhere 2. The deprecated methods can be checked in the Interpreter, so we can now emit deprecation warnings for stuff that was deperecated in 0.44! 3. We can share this more strongly typed method everywhere
2025-10-20interpreter: port dependency main to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency language to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency include_type to typed_kargsDylan Baker
The cleanup this allows lower down points out that we don't properly validate the value passed to `as_system()`. I have no idea what happens if you pass a non-valid value, but it's a bug and I've simply made it a hard error. We can re-assess if necessary.
2025-10-20interpreter: port dependencies components to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency cmake_package_version to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency cmake_module_path to typed_kwargsDylan Baker
2025-10-20dependency: Use a TypedDict to describe the keyword arguments to DependencyDylan Baker
This allows us to check that all of the keyword arguments are of the correct type.
2025-10-16intro: compute meson_variables for dependencies at setup timePaolo Bonzini
Another place where the interpreter is accessed surreptitiously is dependency introspection, which looks at the variables. Do that at setup time instead while the interpreter is alive. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-06Revert "compilers: refactor sanity checking code"Dylan Baker
This reverts commit 806289a5d27958a084bc6cba41b7cf9ccee4ecf4.
2025-10-06compilers: refactor sanity checking codeDylan Baker
The goal is to reduce code duplication, and allow each language to implement as little as possible to get good checking. The main motivation is that half of the checks are fragile, as they add the work directory to the paths of the generated files they want to use. This works when run inside mesonmain because we always have an absolute build directory, but when put into run_project_tests.py it doesn't work because that gives a relative build directory.
2025-09-25mypy: enable allow-redefinition-new and fix falloutEli Schwartz
Reduces 3 errors that show up in newer mypy versions than pinned in CI. It is new since 1.16 and a likely future default for mypy 2.0. It allows things like: ``` for i in ['one', 'two', 'three']: frob_a(i) for i in [1, 2, 3]: frob_b(i) ``` since "i" is obviously used as a loop holder and its type can be freely reinvented. Note: allow-redefinition-new isn't actually about this at all, it has greater scope than loop holders and allows redefining "unannotated variables" of all kinds. No granularity in what to accept redefinition of. :P To enable this, we must also opt in to local-partial-types, which has some overlap with None-safety. Specifically: > the most common cases for partial types are variables initialized > using None, but without explicit X | None annotations. By default, mypy > won’t check partial types spanning module top level or class top level. > This flag changes the behavior to only allow partial types at local > level, therefore it disallows inferring variable type for None from two > assignments in different scopes. So with this, we also fix a couple of actual type errors this revealed. Where possible, stop None-initializing at all -- it's not strictly needed for global variables, anyway, and it's a coding error if it is possible to hit these variables without defining them first. Bug: https://github.com/python/mypy/issues/19280
2025-06-23vala: Also add --target-glib if glib is built as subprojectFlorian "sp1rit"​
Previously, meson would only check if glib was part of target.external_dependencies and add --target-glib appropriately. This however had the downside of meson not adding --target-glib if glib was included as a subproject, potentially breaking otherwise builds. Instead of checking external_dependencies, check target.added_deps for an occurrence of 'glib-2.0' and then pick the appropriate codepath (either from the external dependency based on version_reqs or for the internal dependency based on the actual version, potentially downgraded to the latest release version) Related-to: #14694
2025-03-10coredata: replace get_option with optstore.get_value_forDylan Baker
This is an old method, that is now just a wrapper around the OptionStore method, that doesn't add any value. It's also an option related method attached to the CoreData instead of the OptionStore, so useless and a layering violation.
2025-01-19Fix broken both_libraries transitive dependenciesCharles Brunet
#13837 broke both_lib transitive deps, because the `as_static` and `as_shared` functions return libraries that still contain references to the other lib type.
2025-01-07Fix internal dependency namesCharles Brunet
Internal dependency names were generated from object id. This cause problem when objects are copied, especially when generating partial dependency, or when extracting shared or static dependencies from both_library, because dependency names in target and dependencies introspection files become unrelated. This fixes that by generating the dependency name from the internal id, and by using that base name when generating partial dependencies.
2024-09-23dependency: define equality and hash operators for DependencyDylan Baker
When a dependency is copied and its name is changed, we still need a way to say "this is the same dependency", which we now have. It is important, however, when a partial dependency is created that dependency does *not* match the original dependency, since they are not providing the same data. This was always happening for InternalDependencies as an implementation detail, but not for other kinds.
2024-09-21Add get_variable() system dependencyunknown
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-09-11Fix typing for InternalDependency.get_as_static() and get_as_shared()Charles Brunet
2024-09-06alias_target with both_libs builds bothCharles Brunet
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2024-07-05Revert PR12972 as a regression.Eli Schwartz
Revert "interpreter: when overriding a dependency make its name match" This reverts commit b1340e9bb1f243e4de8f2d89415a45ade476a3dc. Revert "dependency: define equality and hash operators for Dependency" This reverts commit 6d713e40f81512eadb0cc4654408d90cb22ba774. This caused some projects to fail to build, such as libplacebo and libepoxy. Taking libplacebo as the example, the produced build.ninja does not include libvulkan.so as a linker input for src/libplacebo.so.338. We are probably getting dependency hashing wrong somewhere. Unsure where exactly and unsure how to create a test case. We are also deep into rc2. Revert it for now and try to re-land these changes for 1.6. Bug: https://bugs.gentoo.org/935443 Fixes: #13352
2024-04-28add punctuation mark to make log more understandablekkz
2024-03-15dependency: define equality and hash operators for DependencyDylan Baker
When a dependency is copied and its name is changed, we still need a way to say "this is the same dependency", which we now have.
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-12-01dependencies/base: Make MissingCompiler inherit Compiler for mypyDylan Baker
This allows mypy and pyright to correctly determine the return types from methods, but makes 0 changes at runtime.
2023-09-18Remove get_configtool_variable()Xavier Claessens
This also makes it more consistent with get_pkgconfig_variable() which always return empty value instead of failing when the variable does not exist. Linking that to self.required makes no sense and was never documented any way.
2023-09-18Remove get_pkgconfig_variable()Xavier Claessens
Make sure that pkgconfig_define is a pair of strings and not a list with more than 2 strings.
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-08-08interpreter|dependencies: Fix issues spotted by mypyDylan Baker
Which is mostly that other annotations are wrong.