summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/__init__.py
AgeCommit message (Collapse)Author
2021-11-01interpreter/modules: ModuleReturnValue can hold ExecutableSerialisationDylan Baker
The code for this exists and works, but the type annotations don't allow it. This fixes the annotations
2021-11-01modules: remove harmful forwarding init methodsDylan Baker
There is no reason for these inititializers to exist, all they do is defer to the parent initializer. Worse, since they are not type annotated thy prevent the parent type annotations from being used
2021-10-08ModuleState: Add wrapper to get optionXavier Claessens
2021-09-30modules: make ReturnValue.new_objects covariantDylan Baker
Otherwise we have to do a lot of casting to ensure that we get the appropriate invariant type
2021-09-24build: use an object rather than a dict for the dep_manifestDylan Baker
This really is more of a struct than a dict, as the types are disjoint and they are internally handled, (ie, not from user input). This cleans some things up, in addition I spotted a bug in the ModuleState where the dict with the version and license is passed to a field that expects just the version string.
2021-09-14apply flake8 fixes for unused imports and missing importsEli Schwartz
2021-08-31pylint: turn on superflous-parensDylan Baker
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-08-22Add typing to ModuleState machine membersTristan Partin
2021-08-15correct a copy-pasted commentEli Schwartz
2021-08-09modules: Fix typo in state.test()Xavier Claessens
Fixes: #9081
2021-08-06modules: Add API to add testXavier Claessens
This fix kwargs not going through typed_kwargs() decorator that sets defaults. Fixes: #9009
2021-06-30interpreter: add required and disabled to importDylan Baker
This is useful both from the perspective of optional functionality that requires a module, and also as I continue to progress with Meson++, which will probably not implement all of the modules that Meson itself does.
2021-06-30modules: add classes with the found methodDylan Baker
These will be needed for checking whether a module is found or not if it is required false.
2021-06-18holders: remove unholderDaniel Mensinger
2021-06-15modules: pass all proxied argumentsDylan Baker
2021-06-15modules: Fix type annotation importsDylan Baker
2021-06-15modules/qt: Add a compile_moc methodDylan Baker
This method only compiles moc resources, nothing else
2021-05-28modules: Replace find_program_impl() by state.find_program()Xavier Claessens
2021-05-28modules: Add methods dict everywhereXavier Claessens
This fix calling random internal methods from meson.build as long as they were not prefixed by underscore.
2021-05-28modules: Stop using InterpreterObjectXavier Claessens
Custom objects returned by modules must be subclass of ModuleObject and have the state argument in its methods. Add MutableModuleObject base class for objects that needs to be deep copied on assignation.
2021-05-28modules: Remove snippet methodsXavier Claessens
The only advantage they have is they have the interpreter in arguments, but it's already available as self.interpreter. We should discourage usage of the interpreter API and rely on ModuleState object instead in the future. This also lift the restriction that a module method cannot add build targets, but that was not enforced for snippet methods anyway (and some modules were doing it) and it's really loose restriction as it should check for many other things if we wanted to make it consistent.
2021-05-12gnome: Fix gtkdoc generationXavier Claessens
install_scripts used to replace @BUILD_ROOT@ and @SOURCE_ROOT@ but it was not documented and got removed in Meson 0.58.0. gnome.gtkdoc() was relying on that behaviour, but it has always been broken in the case the source or build directory contains spaces. Fix this by changing get_include_args() to substitue paths directly which will then get escaped correctly. Add a unit test that builds GObject documentation which is where this issue has been spotted. Fixes: #8744
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04Simplify module APIXavier Claessens
- ModuleState is now a real class that will have methods in the future for actions modules needs, instead of using interpreter internal API. - New ModuleObject base class, similar to InterpreterObject, that should be used by all objects returned by modules. Its methods gets the ModuleState passed as first argument. It has a `methods` dictionary to define what is public API that can be called from build definition. - Method return value is not required to be a ModuleReturnValue any more, it can be any type that interpreter can holderify, including ModuleObject. - Legacy module API is maintained until we port all modules. In the future modules should be updated: - Use methods dict. - Remove snippets. - Custom objects returned by modules should all be subclass of ModuleObject to get the state iface in their methods. - Modules should never call into interpreter directly and instead state object should have wrapper API. - Stop using ModuleReturnValue in methods that just return simple objects like strings. Possibly remove ModuleReturnValue completely since all objects that needs to be processed by interpreter (e.g. CustomTarget) should be created through ModuleState API.
2020-09-08typing: more fixesDaniel Mensinger
2020-05-15ninjabackend: Treat GNOME gir/typelib as librariesNirbheek Chauhan
When classifying generated sources, we were treating gir/typelib files generated by gobject-introspection as headers. This is bad because it serializes the build by adding order-only dependencies to every target even though sources will never actually use them for anything. Treat them as libraries, which is somewhat more accurate.
2020-03-05Make use of unholderDylan Baker
We have a lot of cases of code like: ```python if hasattr(var, 'held_object'): var = var.held_object` ``` replace that with the unholder function.
2019-11-08Created the filesystem module.Jussi Pakkanen
2019-03-28Revert "gnome.compile_resources: Add ld binary method"Jussi Pakkanen
This reverts commit 59791fc56966901038aaaac23942bc8ac6e11494, reversing changes made to e26b5a119e0b3f76cc93f65ecf4251dc6d52ecfe.
2019-02-01gnome.compile_resources: Add ld binary methodNinja-Koala
Instead of generating a c file that gets compiled, directly create object file with ld. See https://gitlab.gnome.org/GNOME/glib/issues/1489
2018-07-05Fix flake8 issues (#3834)Jon Turney
* Fix flake8 whitespace reports $ flake8 | grep -E '(E203|E221|E226|E303|W291|W293)' ./mesonbuild/coredata.py:337:5: E303 too many blank lines (2) * Fix flake8 'variable assigned value but unused' reports $ flake8 | grep -E F841 ./mesonbuild/modules/gnome.py:922:9: F841 local variable 'target_name' is assigned to but never used * Fix flake8 'imported but unused' reports $ flake8 | grep F401 ./mesonbuild/compilers/__init__.py:128:1: F401 '.c.ArmclangCCompiler' imported but unused ./mesonbuild/compilers/__init__.py:138:1: F401 '.cpp.ArmclangCPPCompiler' imported but unused ./mesonbuild/modules/__init__.py:4:1: F401 '..mlog' imported but unused PR #3717 imports ARMCLANG compilers in __init__, but does not add them to __all__, so they are not re-exported by the compilers package like everything else. * More details about flake8 in Contributing.md Mention that Sider runs flake8 Suggest seting flake8 as a pre-commit hook
2018-07-02Remove permittedSnippetKwargs, snippets are not specialNirbheek Chauhan
All we needed to do was change _get_callee_args() to also support snippets.
2018-06-06Fix issues found by flake8Xavier Claessens
2018-04-15Convert Gnome module to use find_program from interpreter.Jussi Pakkanen
2017-10-31namespace run_targets by subprojectMartin Kelly
Currently, run_target does not get namespaced for each subproject, unlike executable and others. This means that two subprojects sharing the same run_target name cause meson to crash. Fix this by moving the subproject namespacing logic from the BuildTarget class to the Target class.
2017-09-21flake8: Clean up complained-about unused importsLuke Shumaker
This also adds a "# noqa: F401" comment on an unused "import lzma", which we are using it in a try/except block that is being used to check if the lzma module is importable; of course it is unused. v2: This turned out to be a little tricky. mesonbuild/modules/__init__.py had the "unused" import: from ..interpreterbase import permittedKwargs, noKwargs However, that meant that the various modules could do things like: from . import noKwargs # "." is "mesonbuild.modules" Which breaks when you remove __init__.py's "unused" import. I could have tagged that import with "# noqa: F401", but instead I chose to have each of the module import directly from "..interpreterbase" instead of ".".
2017-07-02Improve "Passed invalid keyword argument" warning.Jehan
I got this warning on a build: > WARNING: Passed invalid keyword argument preset. This will become a hard error in the future. I had to grep in meson code to understand that "preset" was the name of the invalid argument. This is not obvious at all depending on the argument name (here it looked like it was about argument presets). Let's make it clearer by putting it in quotes.
2017-06-26Fixed issues raised in review.Jussi Pakkanen
2017-06-26Converted some modules.Jussi Pakkanen
2017-06-26Add kwarg checker in module code.Jussi Pakkanen
2017-03-28modules: Start using @SOURCE_ROOT@ and @BUILD_ROOT@Nirbheek Chauhan
First step in fixing https://github.com/mesonbuild/meson/issues/1419 Also works around an issue in the MinGW windres.exe that causes it to fail if any of the arguments passed to it contain a space. There seems to be no way to quote or escape the spaces in the path to make windres parse the path correctly, so we just warn about it instead. https://sourceware.org/bugzilla/show_bug.cgi?id=4933 https://github.com/mesonbuild/meson/pull/1346
2017-01-09There are two different kinds of extensions: modules that create newJussi Pakkanen
objects directly and snippets that just call into interpreter methods.
2017-01-04Create a module return value object.Jussi Pakkanen
2016-12-28Move _get_include_args from gnome to modules.Elliott Sales de Andrade
2016-12-19fix some of pylint's undefined-variableIgor Gnatenko
************* Module mesonbuild.modules.rpm E:106,29: Unsupported format character '{' (0x7b) at index 16 (bad-format-character) ************* Module mesonbuild.modules E: 12,14: Undefined variable 'MesonException' (undefined-variable) ************* Module mesonbuild.modules.gnome E:699,69: Undefined variable 'sargs' (undefined-variable) ************* Module mesonbuild.wrap.wrap E:103,25: Undefined variable 'checkoutdir' (undefined-variable) ************* Module mesonbuild.backend.backends E: 83,16: Undefined variable 'mlog' (undefined-variable) ************* Module mesonbuild.backend.ninjabackend E:254,105: Undefined variable 't' (undefined-variable) Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-16modules: Cache programs found by find_programNirbheek Chauhan
This avoids printing several 'Found:' messages during configure, and also avoids doing several searches for the same binary. This is already done by the interpreter for `find_program` calls from build files. Also move it to the module-wide __init__.py file so it can be used by other modules as-needed. Also use it for g-ir-scanner where it was missed in one place, also fix exception name in the same place.
2016-12-15Allow all code to access module target classesNirbheek Chauhan
It is often useful to be able to check if a specific object is of a type defined in a module. To that end, define all such targets in modules/__init__.py so that everyone can refer to them without poking into module-specific code.
2016-01-16Fix some issues that break pypi installs and bump version to upload new version.Jussi Pakkanen