summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/external_project.py
AgeCommit message (Collapse)Author
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-08-26Print external project logfile on CI systemsTobias Diez
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.
2024-11-19make external_project work again on MinGWMihailJP
On Python 3.12, self.prefix.relative_to(self.prefix.drive) no longer works and raises error like: ``` ValueError: 'C:/msys64/mingw64' is not in the subpath of 'C:' ```
2024-10-28external-project: Setup devenv to run programsXavier Claessens
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2023-12-22modules: get rid of the .*machine variablesDylan Baker
They're hardly used, and can be gotten directly from the Environment instead
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-08external_project.py: fix --host valueStas Sergeev
Currently in cross-compilation mode the --host is set to x86-linux-linux, which results in an error. Change the code so that for x86 and x86_64 the second part is 'pc', and 'unknown' for the rest. Use cpu model instead of cpu family for the first part, as suggested by @dcbaker As the result, we get: i386-pc-linux on my setup. Fixes #12608
2023-09-18pkgconfig: Set PKG_CONFIG in env for devenv and g-ir-scannerXavier Claessens
2023-08-18Add more descriptive description to CustomTargetCharles Brunet
Allow modules using CustomTarget to modify the command description used by ninja backend. This result in more precise logs when building a project.
2023-08-03PkgConfigDependency: Move CLI handling into its own abstractionXavier Claessens
This makes the code cleaner and will allow to have other implementations in the future.
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-26dependencies: defer importing a custom dependency until it is usedEli Schwartz
This lessens the amount of code imported at Meson startup by mapping each dependency to a dictionary entry and using a programmable import to dynamically return it. Minus 16 files and 6399 lines of code imported at startup.
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-04-20extra_files keyword in declare_dependency()Charles Brunet
2023-02-01treewide: add future annotations importEli Schwartz
2023-01-10modules/external_project: `make` should be immutableDylan Baker
In some cases we'll get an `ImmutableListProtocol[str]` anyway (and actually, we should probably be getting one in call cases), since we don't mutate it anyway, just store it as immutable.
2023-01-04add objects keyword argument to declare_dependenciesPaolo Bonzini
2022-11-29pylint: enable the bad_builtin checkerDylan Baker
This finds uses of deny-listed functions, which defaults to map and filter. These functions should be replaced by comprehensions in idiomatic python because: 1. comprehensions are more heavily optimized and are often faster 2. They avoid the need for lambdas in some cases, which make them faster 3. you can do the equivalent in one statement rather than two, which is faster 4. They're easier to read 5. if you need a concrete instance (ie, a list) then you don't have to convert the iterator to a list afterwards
2022-09-06Fix install_subdirs not showing up in intro-install_plan.jsonThomas Li
2022-08-17interpreter: move handling of module stability to interpreterDylan Baker
Thanks to `ModuleInfo`, all modules are just named `foo.py` instead of `unstable_foo.py`, which simplifies the import method a bit. This also allows for accurate FeatureNew/FeatureDeprecated use, as we know when the module was added and if/when it was stabilized.