Commit Graph

1160 Commits

Author SHA1 Message Date
Dylan Baker e15f15d904 modules/pkgconfig: get rid of modifications to the BuildTarget objects
This would tack on extra attributes for meta data tracking. Do that with
our own datastructures instead
2022-08-18 21:57:36 -04:00
Dylan Baker 3f63827527 modules/pkgconfig: ensure "name" is not None
The name can be None if a library is not passed as a positional
argument, and the name keyword argument is not provided. We shouldn't
allow that to happen.
2022-08-18 21:57:36 -04:00
Dylan Baker 26f02f50b8 modules/pkgconfig: Get most type annotations added
There are still a lot of errors here due to a mixture of really bad
design (adding extra attributes to objects), and legitimate type errors
(passing a str where a List[str] is expected). I suspect a lot of these
cases aren't hit for some reason.
2022-08-18 21:57:36 -04:00
Dylan Baker e84f293f67 modules/pkgconfig: Use typed_kwargs 2022-08-18 21:57:36 -04:00
Dylan Baker ddb95b0ed8 modules/pkgconfig: use typed_pos_args 2022-08-18 21:57:36 -04:00
Dylan Baker 6e75456a75 modules/pkgconfig: fix typo in blocked variable
require_private -> requires_private.
2022-08-18 21:57:36 -04:00
Dylan Baker 48222c45b2 modules/pkgconfig: Fix some low hanging typing issues 2022-08-18 21:57:36 -04:00
Dylan Baker 991baf56e9 modules/fs: Replace configure_file(copy:) with fs.copyfile
`configure_file` is both an extremely complicated implementation, and
a strange place for copying. It's a bit of a historical artifact, since
the fs module didn't yet exist. It makes more sense to move this to the
fs module and deprecate this `configure_file` version.

This new version works at build time rather than configure time, which
has the disadvantage it can't be passed to `run_command`, but with the
advantage that changes to the input don't require a full reconfigure.
2022-08-18 16:53:36 -04:00
Dylan Baker a78992dd81 interpreter: move handling of module stability to interpreter
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.
2022-08-17 16:25:36 -04:00
Dylan Baker c32f83a829 modules: Add stabilization information to ModuleInfo
We're going to do more with this in the next commit, but this just adds
the information for now. This allows the next commit have 100% mv
changes for some of the modules, which makes review easier
2022-08-17 16:25:36 -04:00
Dylan Baker 6843f56f6b modules: use module level information about new and deprecation
Instead of using FeatureNew/FeatureDeprecated in the module.

The goal here is to be able to handle information about modules in a
single place, instead of having to handle it separately. Each module
simply defines some metadata, and then the interpreter handles the rest.
2022-08-17 16:25:36 -04:00
Eli Schwartz 37f95303f0
typing: simplify type annotations for libraries
In a bunch of places we need to list various types of libraries
including custom_target outputs, and it gets very long. Use a common
T.Union for this.
2022-08-04 20:06:01 -04:00
Eli Schwartz 1e1dee738b qt module: correctly compare program name for lrelease version
(b, name) will always have the canonical tool name, not just a
potentially weird bin path. We need to check stderr for qt4 tools other
than lrelease, but we keyed off of the tool bin path, so matches were by
no means guaranteed, and specifically, would fail if the tool is looked
up via bindir.

This really should always have checked the canonical name, which is
guaranteed to be correct.

Partial fix for #10443
2022-07-25 21:56:11 -07:00
Dylan Baker 0bf66ff02c modules/wayland: Add full type checking 2022-07-17 12:58:17 -04:00
Eli Schwartz e7d87b6f58
implement the new preserve_path kwarg for install_data too
Primarily interesting to me because it is then available for the python
module's install_sources method.

Based on the new feature in install_headers.
2022-07-08 01:58:23 -04:00
Richard Hughes 407eaa3b4a gnome module: Use --quiet to supress printing the link command line
This removes one line of stderr output per GObject Introspection file
processed, e.g.

g-ir-scanner: link: gcc -o Fwupd-2.0 Fwupd-2.0.o -L. -Wl,-rpath...
2022-07-06 15:29:41 -04:00
Marc-André Lureau 6096337904 pkgconfig: do not add valgrind as requirement
For the same reasons commit 7aa28456d ("Add dependency type for
Valgrind") removed linking with valgrind, pkgconfig shouldn't generate
"Requirements" for it, in general.

This solves dbus meson port question/issue from:
https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/303#note_1444819

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-06 10:36:44 -07:00
Eli Schwartz 0703ee0aef
move various unused typing-only imports into type-checking blocks 2022-07-03 14:11:31 -04:00
Eli Schwartz 22dcb692ad python module: implicitly add python dep to extensions
If there isn't a preexisting dependency on python, append one. It's
almost assuredly needed, so just do the right thing out of the box.
2022-06-19 21:44:17 +03:00
Eli Schwartz 43c60318fd python module: cache dependency() lookup between invocations
Modeled similarly after the installations cache, but using the coredata
dependency cache because it has a nice mechanism for handling the cache
key.
2022-06-19 21:44:17 +03:00
Eli Schwartz 28835cce71 gnome module: fix regression that broke using built xml files as gresources
In commit 3dcc712583 we moved to
typed_pos_args. In the process, we deleted some code to specifically
raise an error if you use custom_target or generator outputs, instead
leaving it out of the typed pos args.

However, that support was specifically supposed to be there. It was only
an error in part of an if statement for handling old versions of
glib-compile-resources. The specific error it calls out is that we need
to manually parse the depfile at configure time, due to an external bug;
obviously this is impossible if the gresource is only created at build
time.

Reinstate the original error message check, and allow built outputs to
be used as compile_resources() inputs.

Fixes #10367
2022-06-19 17:39:18 +03:00
Olexa Bilaniuk b19d312dc7 Update CUDA Toolkit/driver version table for recent releases.
Agrees with Release Notes, Section 1.1, Table 3.
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
2022-06-19 02:08:20 -04:00
Xavier Claessens 807cbcb350 external-project: Add depends kwarg
The unit test was racy but surprisingly never failed on CI. The reason
is we need to ensure ninja build somelib.so before running `make` into
the external project.
2022-06-17 18:56:13 -04:00
Eli Schwartz edb38fd6f6
fix confusing incorrect default name for a KwargInfo
We can use this lots of places, and it's always the same kwarg. There
doesn't seem to be a point in naming it badly, then evolving it to the
standard name in the one place it is currently used. This made it not
shareable.
2022-06-17 14:33:01 -04:00
Michael Mera 9b21428006 fix parameter expansion in several error messages
At several points in the code base, f-strings are not correctly expanded
due to missing 'f' string prefix. This fixes all the occurrences I could
find.
2022-06-17 12:16:42 -04:00
Eli Schwartz 85f3fc2022 flake8: don't use f-strings for strings without formatting 2022-06-13 13:34:39 +03:00
Eli Schwartz 462b35e4b1 flake8: fix various whitespace nits 2022-06-13 13:34:39 +03:00
Eli Schwartz a49cd00d64 treewide: various cleanups to move imports for mypy into typechecking blocks
Along the way, add __future__ annotations where lacking.
2022-06-10 09:15:48 -04:00
Eli Schwartz 1eaf49c880 flake8: remove no longer used imports 2022-06-10 09:15:48 -04:00
Xavier Claessens 0aeb61bd52 wayland: Lookup for wayland-scanner using pkgconfig
Just like some of glib tools, wayland-scanner can be defined in the
pkgconfig dependency variables. Share code between gnome and wayland
modules into ModuleState.
2022-06-10 00:48:25 -04:00
Dylan Baker 618b187f70 interpreter: use a shared KwargInfo for install_dir
CustomTarget allows multiple install dirs, while basically everything
else allows only one. So this provides a shared instance for that.
2022-06-01 22:49:10 -04:00
Dylan Baker 7b90066a01 modules/gnome: fix gen_marshall annotation 2022-06-01 22:49:10 -04:00
Dylan Baker a2def550c5 modules: move gnome targets into gnome module
They're not used outside of the gnome module anyway, and they create
some annoying potentials for dependency loops
2022-06-01 22:49:10 -04:00
Eli Schwartz c88a1dc55c
fix bug in i18n merge_file/itstool_join revealed by previous commit
Logically, i18n.merge_file cannot ever take a MULTI_OUTPUT_KW, but it
does take a CT_OUTPUT_KW-like interface.

Actually trying to pass multiple merge_file outputs causes the
msgfmthelper script to be entirely malformed in the arguments it
accepts, and treat the broken one like a --flag, then exit with argparse
errors.

Even if we somehow assumed that somehow it was designed to actually
allow this, msgfmt doesn't support conceptually passing multiple outputs
so that would be a msgfmt error instead of an error inside the guts of
`meson --internal msgfmthelper`.

Same logic applies again for the itstool command and the itstool
internal helper.

Catch this error at configuration time by using the single-output kwarg
form.

Likewise, it's totally nonsense to accept multiple install_dir or
install_tags, and ever since commit 11f9638035
the CustomTarget itself won't even check this.
2022-05-31 17:49:29 -04:00
Eli Schwartz 52d01dbf38
rename a badly named KwargInfo
CT_OUTPUT_KW is the same OUTPUT_KW we use in lots of places. The most
distinctive thing about it is not that it's part of custom_target
(basically any other function that uses such a kwarg follows the same
rules due to using CustomTarget under the hood), but the fact that it
takes multiple outputs.
2022-05-31 17:49:29 -04:00
Eli Schwartz e3d70d89b1
fix regression that broke type checking of CustomTarget outputs
We validate a few things here, such as the non-presence of '@INPUT' in
an output name. These got moved out of the CustomTarget constructor in
commit 11f9638035 and into KwargInfo, but
only for kwargs that took multiple values. This caused configure_file()
and unstable_rust.bindgen() to stop checking for this.

Add a shared single-output KW and use it in both places. This now
dispatches to _output_validator.

configure_file now validates subdirectories in output names the same way
we do elsewhere, directly in the typed_kwargs and by specifying the
erroring kwarg.
2022-05-31 17:49:29 -04:00
Eli Schwartz 915a468ed3
i18n: be build-compatible (but not developer-compatible) with gettext-tiny
For maintainer targets, we need some more tools that gettext-tiny
doesn't implement. It's a shame to cause NLS to be completely disabled
in such environments, so instead just issue a warning and continue.

Before 0.62.0 these were never checked for, and would simply fail at
runtime, probably. In theory, the user might install the tools in
between configuring and building, and then the maintainer targets would
begin to work. Return to that behavior -- we still create the targets,
which will *probably* fail, but might not -- and for existing
integrations, failing at `ninja foo-update-po` with "error, program
msgmerge not found" is a bit more discoverable than ninja saying "what
do you mean, there's no such target".

We still have the 0.62.0 preferred behavior of trying to find the
programs, succeeding in all cases other than gettext-tiny, and
guaranteeing that their paths are set up in a machine-file-respecting
manner.
2022-05-29 18:23:03 -04:00
Eli Schwartz de2c091ba6
i18n: fix bug where disabling gettext() broke merge_file()
In the former case, the presence of tools is optional, but triggers a
warning and then no-ops the target. In the latter case, the presence of
the tools is mandatory. But if it was already looked up and discovered
to be missing, we did not actually check that it is found before trying
to use it.

In the case that it isn't found, check again, so that we explicitly
error out with a relevant error message due to setting the required
flag.

Fixes #10320
2022-05-29 18:23:03 -04:00
Eli Schwartz 34da721ec2
gettext: explicitly pass source root / subdir as cli args
Because this is a wrapper script and we could/should do this, we even
have half the infra for it.
2022-05-29 18:23:03 -04:00
Dylan Baker 9c9be9d74b modules/gnome: Fix missing type annotation 2022-05-25 22:41:03 -04:00
Dylan Baker 764b3bf327 modules/gnome: fix some typing issues
That come to light with some of the changes later in this series,
particularly around dependencies.
2022-05-25 22:41:03 -04:00
Dylan Baker 4acab57d47 modules/icestorm: use type checking 2022-05-23 23:32:47 -04:00
Dylan Baker 02ac3d7b2e modules/icestorm: replace individual tools attributes with dict
As we commonly do in other modules
2022-05-23 23:32:47 -04:00
Dylan Baker 10fc19ecb4 modules: add typing to the modtest module 2022-05-23 23:32:47 -04:00
Eli Schwartz 1c52ac4e15
move various imports into TYPE_CHECKING blocks for neatness 2022-05-23 16:44:08 -04:00
Eli Schwartz aa874ea0d0 python module: default extensions to hidden symbol visibility
python compiled extensions should never need to expose any symbol other
than PyInit_* which is declared with default visibility via
PyMODINIT_FUNC on supported compilers.

Thus, a reasonably sane default is to mark any other symbols as hidden,
while still respecting any manually specified visibility.

Gate this on the version of python itself, as not all versions decorate
PyMODINIT_FUNC properly.
2022-05-09 10:49:04 -04:00
Chun-wei Fan 99ad11bd9c Windows: Improve Python 3.8+ module check on Windows
On Python 3.8.x and later, if the imported module requires non-system DLLs that
are not installed nor bundled with the module package, os.add_dll_directory()
must be called on every path that contains the required DLLs, so that the module
can be imported successfully by Python.

Make things easier for people by calling os.add_dll_directory() on the
valid directories in %PATH%, so that such module checks can be carried out
successfully with much less manual intervention.
2022-05-02 02:45:51 +03:00
Xavier Claessens ca77adea89 gnome: Make sure g-ir-scanner can use pkg-config properly
We need to setup the environment we pass to g-ir-scanner because it will
try to use pkg-config to find dependencies, and that must respect user
settings from machine file. Also make it use uninstalled pc files Meson
generated in the case dependencies, such as glib, have been built as
subproject.
2022-04-30 15:01:28 -04:00
Xavier Claessens 18bec0d3e3 pkgconfig: Use EnvironmentVariables to build PKG_CONFIG_* env
The new get_env() method that returns an EnvironmentVariables object
will be needed in next commit that will pass it to CustomTarget.

This has the side effect to use the proper os specific path separator
instead of hardcoding `:`. It is the obvious right thing to do here, but
has caused issues in the past. Hopefully issues have been fixed in the
meantime. If not, better deal with fallouts than keep doing the wrong
thing forever.
2022-04-30 15:01:28 -04:00
Eli Schwartz 93ed7531c4 qt module: fix missing sanity check for install_dir + install
Regression in commit 11f9638035. When
`install: true` the install_dir must be set. The CustomTarget
initializer no longer checks this for us, so we must include the check
ourselves.
2022-04-30 11:49:12 +03:00