Commit Graph

12134 Commits

Author SHA1 Message Date
Pablo Correa Gómez 270843ed34
test cases/frameworks/13 yelp: Do not reuse sources files
Additionally reorder test.json for better readability
2022-01-02 00:34:49 -05:00
Jussi Pakkanen cf3a23dcce
Merge pull request #9758 from eli-schwartz/meson_add_foo_script-argchecks
add_*_script: fix validation and do FeatureNew checks
2021-12-31 15:58:30 +02:00
Eli Schwartz 688b4bac76 add FeatureNew decorators for various modules that were lacking them
Going back to 0.38, though some of them are far older. The original
implementation of FeatureNew only added backdated feature checks that
far, anyway.
2021-12-31 12:03:57 +02:00
Eli Schwartz 9f8df3529f rename lint workflow for less confusion
For a long time now, this has done 3 different things, only one of which
is mypy. But they are labeled:

- LintMypy / lint

  (runs pylint)

- LintMypy / custom_lint

  (runs a custom script)

- LintMypy / mypy

  (actually runs mypy)

This reduces the usable length of the label which isn't all that long to
begin with, is actively misleading, and even when you know what is going
on, it becomes harder to tell at a glance what failed. Change it to be
more unambiguous.
2021-12-31 12:01:34 +02:00
Eli Schwartz 812ad2e6d1
fix type annotations for mlog nesting
In commit 8cd4d0b283 we added a feature
that took True/False but said it took str.
2021-12-30 15:15:25 -05:00
Eli Schwartz 9f384e9207
fix type annotations for compiler toolchain rpaths
We pass around a tuple of rpaths, because rpaths *can* be more than one.
But all the annotations said it would be a str instead.
2021-12-30 15:15:25 -05:00
Eli Schwartz 19c9f32cef
correct type annotations for File.endswith
It should accept whatever str.endswith accepts, which means optionally a
tuple of options.
2021-12-30 15:15:25 -05:00
Eli Schwartz db528e3bb9
fix crash during MesonException
In commit e5a6283c4c, this function was
reorganized to assign value -> newvalue instead of overwriting newvalue,
but the error message case wasn't updated to match. As a result,
actually hitting the error would report an even more errory error, i.e.
a traceback.

(Actually hitting the error requires passing an array option as a python
object that isn't a list or a string. This is impossible to do from the
command line or meson_options.txt, but can be done with builtin options.)
2021-12-30 15:15:25 -05:00
Eli Schwartz d46ac459e9
fix incorrect docs for add_*_script
They claimed that all of these functions accepted any posargs or varargs
that install scripts supported. This was inconsistent with both the
types that meson currently allowed, and the types that we documented in
refman 1.0 *should* be allowed.

Take the opportuninty to be clear as refman 1.0 never was, about the
difference between types supported in the first posarg, and the ypes
supported in succeeding varargs.
2021-12-30 15:14:18 -05:00
Eli Schwartz cb6a6dbca4
remove no longer needed validation routine
We don't need to check when processing the script args, whether the
correct types were passed. We check this upfront in typed_pos_args now.
2021-12-30 15:14:18 -05:00
Eli Schwartz 6e25548d06
add_*_script: fix incorrect typed_pos_args allowing built targets
In commit c239ce31f5 support was added to
these functions to accept various non-string types.

Despite the commit/PR documenting that only add_install_script is
permitted to accept built files, the actual check parameter was set, for
all three, to "True" (so the function was never invoked with False at
all). This meant that actually attempting to use the allowed types would
fail at postconf or dist, with python tracebacks in the former case and
"Failed to run dist script" in the latter case.

This was partially ameliorated in commit
6c5bfd4c24 which added typed_pos_args, but
unfortunately those typed_pos_args were all over the place.

For postconf:
- They banned external programs as additional args (which should be allowed)
- They banned built executables (good)
- They allowed custom targets as additional args (bad)

For dist:
- they allowed external programs (good)
- they allowed built executables, but only as the first argument (bad, also ???)
- they allowed custom targets, but only as additional arguments (bad, also ???)

Fix this all to only allow the same argument types for both the script
argument and the script-args arguments. That type is known at configure
time and restricted to source files, configured files, and found
programs.
2021-12-30 15:14:18 -05:00
Eli Schwartz f6eaf55906
add_*_script: fix missing FeatureNew for non-string arguments
In commit 2c0eaf5c4f support was added for
install scripts to accept found programs, built executables, or custom targets.

In commit c239ce31f5, this was extended to
dist and postconf scripts too (although it was documented that those
should not accept targets that are built by ninja).

Despite the commit/PR claiming that all of these should always accept
files and configured files, this was only true for arguments other than
the first, until commit f808c955ea.

In amongst all this, FeatureNew checks were never registered for the
first argument, only for additional arguments, until late in the game
with the addition of FeatureNew checks for File objects.

Fix this in part by moving the 3 different File checks into one, inside the
function that processes the first script, and make that function check
for FeatureNew on anything else too.
2021-12-30 15:14:17 -05:00
Eli Schwartz 1708148f51
unpin pylint in CI -- the mentioned issue is long since fixed
And the outdated pin means some error messages that are a lot better in
newer versions aren't available.
2021-12-30 14:28:45 -05:00
Eli Schwartz 3304a38496
cygwin: fix broken python versions
multiple versions of python are packaged by cygwin, and the default
python is auto-selected as the latest one via a Debian-like alternatives
system.

This recently broke because dblatex is built against 3.9, causing it to
be installed too and resulting in multiple (inconsistent) versions of
python being installed, and `python3` pointing to the one we don't have
devel packages for and isn't even the default version.

Fix this by pointing back to the intended python.
2021-12-30 00:54:14 -05:00
Tristan Partin 269337ceb2 Fix mypy 0.930 issues
Removed errant "type: ignore".

Fixed issue with "fetch" call. This issue was the following:

Dict::get() and Dict::pop() have the following signature:

T.Callable[[_T, _U], _U | None] OR T.Callable[[_T], _U | None]

Note how the return type is _U here. When the fetch() function was
actually being called, it had the following signature:

T.Callable[[_T, T.List[_U]], T.Union[T.List[_U], _U]]

This is incompatible with the previous definitions. The solution is
simply to move where the default value is introduced if fetch() produces
None.
2021-12-30 00:53:58 -05:00
Nirbheek Chauhan 37b122b87e unit tests: Don't check quoting with multiple libs
pkgconf has a bug on MSYS2 due to which prefixes with spaces are not
handled correctly if the library has a Requires: on another library
and both have prefixes with spaces in them.

See: https://github.com/pkgconf/pkgconf/issues/238

So move the unit test to libanswer.pc instead of libfoo.pc till that
is fixed.
2021-12-22 12:12:11 +05:30
Nirbheek Chauhan 351aee8ace Don't wipe out RPATHs specified by dependencies
Since we scan all dependencies for build-only RPATHs now (which are
removed on install), we must take care not to add build-only RPATHs
pointing to directories that dependencies explicitly add -Wl,-rpath
link args for, otherwise the paths will get wiped on install.

Caught by LinuxlikeTests::test_usage_pkgconfig_prefixes
2021-12-22 12:12:11 +05:30
Nirbheek Chauhan 06b1132f82 Set RPATH for all non-system libs with absolute paths
If a pkg-config dependency has multiple libraries in it, which is the
most common case when it has a Requires: directive, or when it has
multiple -l args in Libs: (rare), then we don't add -Wl,-rpath
directives to it when linking.

The existing test wasn't catching it because it was linking to
a pkgconfig file with a single library in it. Update the test to
demonstrate this.

This function was originally added for shared libraries in the source
directory, which explains the name:
https://github.com/mesonbuild/meson/pull/2397

However, since now it is also used for linking to *all* non-system
shared libraries that we link to with absolute paths:
https://github.com/mesonbuild/meson/pull/3092

But that PR is incomplete / wrong, because only adding RPATHs for
dependencies that specify a single library, which is simply
inconsistent. Things will work for some dependencies and not work for
others, with no logical reason for it.

We should add RPATHs for *all* libraries. There are no special length
limits for RPATHs that I can find.

For ELF, DT_RPATH or DT_RUNPATH are used, which are just stored in
a string table (DT_STRTAB). The maximum length is only a problem when
editing pre-existing tags.

For Mach-O, each RPATH is stored in a separate LC_RPATH entry so there
are no length issues there either.

Fixes https://github.com/mesonbuild/meson/issues/9543

Fixes https://github.com/mesonbuild/meson/issues/4372
2021-12-22 12:12:11 +05:30
Xavier Claessens 95a4c6a62a pkgconfig: Fix linking to a custom target
When generating pkgconfig file for a library that links to an
uninstalled static library built by custom_target() Meson was crashing
when trying to access some attributes that does not exist on that class.

Also fix is_internal() implementation, it only really make sense on a
CustomTargetIndex or if CustomTarget has only a single output.
2021-12-22 08:04:08 +05:30
Eli Schwartz ee0baa97cd modules: use find_program implementation to find programs
Do not use ExternalProgram as that is too low-level and doesn't handle
e.g. machine file overrides.

Fixes #9733
2021-12-21 12:17:10 +01:00
Eli Schwartz 6be258137e
modules: let the proxy state find_program do silent lookups 2021-12-20 16:03:43 -05:00
Eli Schwartz d25a335503
restore additional info about the potential cause of find_program failing
Before commit f08eed37cb we also mentioned
that it might not be executable.
2021-12-20 16:03:43 -05:00
Eli Schwartz 71ae5ccb65
restore the ability in the backend to silently find a program
Broken in commit f08eed37cb which moved
the reporting and unconditionally added it.
2021-12-20 16:03:43 -05:00
Dylan Baker 3656b8c6d4 modules/gnome: use T.Sequence instead of T.List
because List is invariant, and that's not what we want.
2021-12-20 16:03:19 -05:00
Dylan Baker 1410d2e9c5 modules/gnome: use typed_kwargs for mkenum
This is the last function that doesn't use typed_kwargs. This now uses
the same shared path as the mkenums_simple
2021-12-20 16:03:19 -05:00
Dylan Baker 7e833d1484 modules/gnome: don't call through mkenums for mkenums_simple
It's just a bad idea, but especially once we start adding type
annotations to both of them.
2021-12-20 16:03:19 -05:00
Dylan Baker 4d8c91134c gnome: use typed_kwargs for mkenums_simple
the simple_version still goes through the big version of this function,
but at last we have type checking
2021-12-20 16:03:19 -05:00
Dylan Baker b2eb890da9 gnome: remove 'template' handling from mkenums
This has never been in permittedKwargs, it does nothing, and it was
never documented, so it seems pretty safe to just remove it.
2021-12-20 16:03:19 -05:00
Matthias Klumpp e60d358e04 ci: Make sure itstool is available on Ubuntu as well
All other CI images already seed it explicitly.
2021-12-18 04:43:19 +01:00
Matthias Klumpp efd7c7f228 i18n: Fix typo for typed_pos_args 2021-12-18 04:43:19 +01:00
Daniel Mensinger c5ce9744b2 Fix mypy errors 2021-12-17 14:00:28 -05:00
Rafael Silva 26f188fb36 add ft32 cpu family 2021-12-17 17:47:21 +02:00
Ben Boeckel 786d437982 armclang: extend the prefix detection for Keil armclang
This will avoid false positives with the ARM Ltd. `armclang` compiler.
2021-12-16 17:08:26 -05:00
Ben Boeckel 28de74c994 armclang: clarify that this is support for the Keil cross-compiler 2021-12-16 17:08:10 -05:00
Dylan Baker e13d92bb6a mesonlib: make get_meson_command return an ImmutableList
We really don't want to be mutating global state, so let mypy yell at us
when we try.
2021-12-15 15:40:59 -05:00
Celeste Wouters c5148d8c73 rewriter: create {add,rm}_extra_files commands
Add ability to mutate a target's `extra_files` list through the
rewriter.

The logic is copied from sources add/rm, but changes the `extra_files`
kwarg instead of the sources positional argument.
Has additional logic to handle creating the `extra_files` list if it
doesn't exist.
2021-12-15 21:21:29 +01:00
Christoph Reiter a2934ca9d1 intl dep: forward static to iconv if needed
In 1fb6c93947 the intl dep gained support for static linking
which also forwarded this property to the iconv sub dependency.

The refactoring in 214d03568f lost this change, which results in
iconv getting linked dynamically again.

Forward static again to fix this.
2021-12-12 07:15:01 -05:00
Jussi Pakkanen 0766182600
Merge pull request #9711 from dcbaker/submit/fix-gnome-typing-regressions
Fix regressions caused by typing changes
2021-12-12 00:16:37 +02:00
Dylan Baker 05d61b4c66 install: Don't run ldconfig on cross builds
Even if we install without a DESTDIR set, we should never update
ldconfig when cross compiling.

Fixes #9707
2021-12-11 21:31:59 +02:00
William Toohey bad383f6b3 Activate VS env when running `meson test` 2021-12-11 21:26:36 +02:00
Dylan Baker 21c3ee3ee7 modules/gnome: fix genmarshall install_dir default
Which needs to be converted from None to an empty list
2021-12-09 13:00:42 -08:00
Dylan Baker e37fd94654 modules/gnome: Fix handling of flags to genmarshal
These are actually just flags, they don't take any arguments (except
prefix, which was already handled correctly), and as such their
arguments should be booleans, not strings, and they should default to
False.
2021-12-09 13:00:42 -08:00
Dylan Baker 29f6724f39 modules/gnome: set genmarshal extra_args default to list
Which is what it should have been all along.
2021-12-09 13:00:42 -08:00
Dylan Baker f45a21af1e tests/rust polyglot: we need to link with bcrypt.lib as well 2021-12-09 15:57:45 -05:00
Dylan Baker 8b5c6ab8f1
docs: Add the `configuration` keyword argument to `configure_File`
We were missing the most important keyword argument of them all!
2021-12-08 14:41:24 -05:00
Eli Schwartz 1e5d7f2122
custom_target: catch and reject input files that do not exist
Currently there is a try/except around the function that detects and
rejects this, which instead of rejecting it, spawns a warning and
continue.

This warning exists because of 'test cases/vala/9 gir/' which passes a
vala generated output that isn't a return value (!!!) using string
joining with the meson.current_build_dir() function (also !!!) because
we officially document this (!!! for a third time) as the only way to
make a vala shared library generate a typelib with a custom_command from
the automatically generated gir:
https://mesonbuild.com/Vala.html#gobject-introspection-and-language-bindings

In #3061 we converted strings to Files, but only if none of them were
this vala hack. Due to the precise implementation, we also failed to
convert strings to Files if any other error occurred, but since we only
want to ignore errors for generated vala outputs, tighten that check and
specifically call out generated files in the warning.

Fixes #8635
2021-12-07 19:47:12 -05:00
Sahnvour d9c73a6a7b clang-cl: add a translation pass for `-isystem` args to work 2021-12-08 00:53:29 +02:00
Dylan Baker 824e09159b modules/gnome: replace FeatureDeprecatedKwarg with typed_kwarg
Using the deprected_message helper.
2021-12-07 16:12:23 -05:00
Dylan Baker 9ef36fa80b modules/gnome: use typed_kwargs for generate_vapi
There is a change here, in that packages has error messaging for using
IncludeDirs objects in the packages argument, but it never worked, so
the message was useless.
2021-12-07 16:12:23 -05:00
Dylan Baker 4ed0df4c31 modules/gnome: use typed_kwargs for genmarshal 2021-12-07 16:12:23 -05:00