aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)AuthorFilesLines
2023-05-31mlog: use a hidden class for stateDylan Baker1-2/+2
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-05-22i18n module: check for a good enough msgfmt before permitting merge_fileEli Schwartz1-1/+10
The concept of merge_file intrinsically requires some GNU-specific functionality, so let's emit a useful error message during configuration, when we don't have that. The relevant GNU gettext versions date back to around 2015 so *probably* anyone has that too, but we may as well verify that while we are here.
2023-05-22i18n module: be broadly supportive of portable gettext toolsEli Schwartz1-1/+1
There are a number of implementations for msgfmt, supporting various options. The simplest, and most common, use case is to compile .po files into .mo files, and this should be able to work on gettext implementations other than the GNU one. The problem is that we were passing some pretty portable arguments in an unportable manner. The `-o` option-argument and its associated argument came after the input file operand, which violates the POSIX Utility Syntax Guidelines, and happens to not be supported by Solaris gettext. The GNU gettext doesn't care; GNU invented GNU argument permutation. Switch the order around so that our use respects the POSIX style.
2023-05-13During reconfigure, show that no compiler was found, if compiler fails ↵Volker Weißmann1-1/+1
sanity check.
2023-05-03cmake module: fix many typing issuesEli Schwartz1-23/+25
In #11761 it turned out that we failed to correctly handle all compiler.sizeof API changes in an old commit, breaking use of the module. And mypy could have caught this for us, except that the module is neither typed nor checked in CI. Partially solve this by adding lots of type annotations, greatly reducing the number of mypy errors in this file from 35 down to 12.
2023-05-03cmake module: make configured file correctly handle the do_conf_file APIEli Schwartz1-5/+5
This doesn't accept a dict, only an actual ConfigurationData object. Due to the way we poke at it, a dict can sort of work anyway, but might not if the internal layout isn't exactly correct. This is evidenced by the way we make the dict values be hard-to-read tuples containing emptiness, because that's how ConfigurationData objects handle descriptions. Simplify and make the seed dictionary readable, then actually convert it into a real ConfigurationData. Bonus: this now passes type checking.
2023-05-03cmake module: use more typed_pos_args for consistencyEli Schwartz1-14/+8
It's shorter and more descriptive. Although we always enforce the same rules either way, a unified decorator is one less line of code for each location, and also tells you how many "too few" arguments you *did* pass.
2023-05-03python bytecompile: use correct install tagEli Schwartz1-1/+1
2023-05-02bytecompile: switch to handling destdir in the script launcher envEli Schwartz1-6/+8
2023-05-02python module: add an automatic byte-compilation stepEli Schwartz1-4/+61
For all source `*.py` files installed via either py.install_sources() or an `install_dir: py.get_install_dir()`, produce `*.pyc` files at install time. Controllable via a module option.
2023-05-02update the devenv module hooks to support generic modifications to BuildEli Schwartz2-5/+6
We may want to do things like update install scripts as well, which have to happen before generating the backend. Instead of adding one module method per thing to do, use a single function that allows for modifying the Build object directly.
2023-05-02fix regression in precomputing CMAKE_SIZEOF_VOID_PMaxHearnden1-1/+1
In commit 808d5934dd6c6a6c16f66e9dc51dae6e83e02cef, compiler.sizeof was refactored to introduce caching, but cmake subprojects did not adapt to that API change and ended up embedding the python repr of a tuple as a cmake variable.
2023-05-02Log python name when not foundCharles Brunet1-3/+3
Fixes #11686.
2023-05-02Find python3.xx on windowsCharles Brunet1-2/+2
2023-05-02Ensure python fallback has the right versionCharles Brunet1-1/+2
Fixes #11057
2023-05-01build: Don't do a deep copy of kwargsXavier Claessens1-1/+1
It seems to only be used by the Rust module now, and it already does a copy.
2023-04-26Add env kwarg to gnome.generate_gir().Volker Weißmann1-1/+4
Fixes #384
2023-04-26Set the CC environment variable for g-ir-scanner.Volker Weißmann1-1/+4
Fixes #1035
2023-04-21modules/rust: Add -DNDEBUG to bindgen if b_ndebug is falseDylan Baker1-0/+3
Otherwise bindgen may generate different behavior than the compiled C code actually has.
2023-04-20extra_files keyword in declare_dependency()Charles Brunet2-2/+2
2023-04-18pkgconfig module: fix traceback on invalid missing descriptionEli Schwartz1-6/+8
If the optional first "mainlib" argument is there, then we infer several values. Otherwise, some of those values fall back to a generic default, and two of them -- name and description -- fall back to being mandatory. In commit e84f293f672a372d2434d0ce4fa39d3f902b6ce8, we removed validation for description as part of refactoring that never actually validated anything.
2023-04-11fix various spelling issuesJosh Soref3-3/+3
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11Change "can not" to "cannot" throughout projectHiPhish1-1/+1
The word "cannot" expresses inability to do something whereas "can not" expresses the ability to refrain from doing something.
2023-03-19CUDA: make "Ampere" equivalent to SM8.0+SM8.6David Seifert1-1/+8
2023-03-16modules/i18n: fix typo in gettext decoratorCorentin Noël1-1/+1
2023-03-16hotdoc: Install devhelp files at the right locationXavier Claessens1-1/+14
When devhelp is enabled, hotdoc generates a devhelp/ subdir that needs to be installed to /usr/share/devhelp/. Otherwise, the html/ subdir needs to be installed to /usr/share/doc/<project>/html/
2023-03-05hotdoc module: properly error out when configuring failsEli Schwartz1-1/+2
We used to just abort during configure because we ran in-process and hotdoc's argparse would leak into our own process space. Now we fail to handle this case and succeed at configuring, only for building to fail because the hotdoc config file doesn't exist.
2023-03-04typed_kwargs: Extend since_values and deprecated_values for typesXavier Claessens1-2/+2
2023-02-22merge the python dependency from the python module into dependenciesEli Schwartz1-206/+2
We have two copies of this code, and the python module one is vastly superior, not just because it allows choosing which python executable to base itself on. Unify this. Fixes various issues including non-Windows support for sysconfig, and pypy edge cases.
2023-02-22partial migration of the python module dependency into dependenciesEli Schwartz1-59/+2
In preparation for wholly merging the dependency handling from the python module into dependencies.*, move the unique class definitions from there into their new home in dependencies.python, which is semantically convenient.
2023-02-22python module/dependency: move the specialized external programEli Schwartz1-77/+11
In preparation for handling more work inside dependencies.*, we need to be able to run a PythonExternalProgram from the python dependency. Move most of the definition -- but only the parts that have no interest in a ModuleState -- and subclass a bit of sanity checking that we need to handle specially when used in the module.
2023-02-22python module: inline the dependency methods checkingEli Schwartz1-3/+3
It can go directly inside the function which immediately uses it. There's no purpose in looking it up exactly once and using it exactly once, but looking it up outside the function and complicating the function signature in order to pass it as a function argument.
2023-02-22python module: move the introspection script into an external scriptEli Schwartz1-79/+6
We write this out as an embedded string to a tempfile in order to run it, which is pretty awkward. And usually Meson's files are already files on disk, not packed into a zip, so we can simply run it directly. Since python 3.7, which is our new minimum, we can handle this well via the stdlib. (There's also mesonbuild.mesondata, but we do not need persistence in the builddir.) This also solves the problem that has always been there, of giant python programs inside strings occasionally confusing syntax highlighters. Or even, it would be nice if we had syntax highlighting for this introspection program. :D
2023-02-22python module: break the association between dependency and installation objectsEli Schwartz1-18/+19
We pass around a PythonInstallation into the depths of the dependency factory, solely so that we can get at is_pypy in one particular branch. We don't need the DSL functions, we don't need access to the interpreter, let's just use the enhanced ExternalProgram object on its own. Add is_pypy to the object, and modify other references to get information from .info['...'] instead of direct access.
2023-02-22python module: fix a few mypy issuesEli Schwartz1-4/+8
Of particular note: We technically cannot pass a NotFoundDependency out of a factory lookup, because it doesn't support External interfaces.
2023-02-08Replace dashes in Java package names with underscores when generating native ↵Tristan Partin1-3/+6
headers This was causing a ninja issue where the native headers were always being generated because io.github.hse-project.hse_Hse.h was being expected, but io.github.hse_project.hse_Hse.h was actually generated.
2023-02-02set default install_tag of python.install_sources() to "python-runtime"Peter Urban1-1/+1
the default parameter for python.install_sources is set to "runtime" but should be "python-runtime" according to the existing documentation - https://mesonbuild.com/Python-module.html#install_sources - https://mesonbuild.com/Installing.html#installation-tags
2023-02-01simplify instantiation of builtin type using builtins instead of functionsEli Schwartz1-2/+2
2023-02-01treewide: add future annotations importEli Schwartz8-2/+8
2023-01-26gnome: Deduplicate include dirs to generate girThibault Saunier1-3/+3
Ensuring the order is respected
2023-01-20Haiku pkgconfig directory layout supportX5121-0/+3
2023-01-10modules: fully type the Qt* modulesDylan Baker3-9/+26
The base module is fully typed, but the numbered version are not, though it's pretty trivial to do so.
2023-01-10modules: add type annotations to the `__init__` moduleDylan Baker1-8/+9
2023-01-10modules/external_project: `make` should be immutableDylan Baker1-1/+6
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-10modules/i18n: fix type annotationsDylan Baker1-1/+1
Again, state.find_program is wrong
2023-01-10modules/icestorm: fix type annotationsDylan Baker1-1/+1
This is also due to the incorrect annotations of state.find_program()
2023-01-10modules/qt: Fix annotations for state.find_programDylan Baker1-3/+3
Because this too, has the wrong assumptions
2023-01-10modules/rust: Fix annotation for _bindgen_binDylan Baker1-2/+2
Which suffers from the same issue as the gnome module
2023-01-10modules/gnome: fix type annotations from `__init__`, which are wrongDylan Baker1-9/+10
Mainly thi sis that `state.find_program()` is annotated incorrectly, it returns `ExternalProgram | Executable | OverrideProgram`, but it's annotated to return only `ExteranlProgram`, and thus a bunch of the annotations in the gnome module are wrong.
2023-01-04forbid using declare_dependency(objects: ...) with pkg-config modulePaolo Bonzini1-0/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>