Commit Graph

917 Commits

Author SHA1 Message Date
Eli Schwartz 9ec3b99a4f do not repeat magic regexes for cmake define replacements
We already have this magic string in mesonlib, and this should always
have used the cmake@ format which is identical to the meson format other
than the regex.
2021-10-27 09:59:08 -04:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Thomas Heijligen ecdf192f46 dep.name(): return dependency name even if dependency is not found
The dep.name() function schould always return the name of the
dependency as documented. No matter if it was found or not.
https://mesonbuild.com/Reference-manual_returned_dep.html#depfound
2021-10-26 09:36:22 -04:00
Olexa Bilaniuk 8fa5b90bf1 Add entries for new CUDA Toolkit versions. 2021-10-21 10:20:17 +05:30
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Eli Schwartz da81586a5b pkgconfig module: correctly generate Libs search path with absolute install_dir
For example the OpenRC build files install libraries to install_dir: '/lib'
and this works, but causes the generated pkg-config to say:

prefix=/usr

Libs: -L${prefix}//lib

which is both ugly (double //) and resolves to /usr/lib which is exactly
what does not work.
2021-10-10 14:30:46 +03:00
Xavier Claessens 329d111709 python: Add platlibdir and purelibdir options 2021-10-08 17:47:35 -04:00
Xavier Claessens 5316c7df62 ModuleState: Add wrapper to get option 2021-10-08 17:47:35 -04:00
Dylan Baker 3f8c78b317 modules/gnome: Fix unset install_dir
install_dir needs to be set to something, because CustomTarget expects
that. genmarshal still relies on CustomTarget setting it internally
itself.

Fixes #9350
2021-10-08 08:44:30 -04:00
Dylan Baker cfa6ff52e9 modules/gnome: Fix case that could never be hit due to bad types
It's impossible to get a Holder here, we'd get the unholdered build
types. Mypy points this out for us.
2021-10-08 08:44:30 -04:00
Dylan Baker bd00ea6b13 modules/gnome: fix use of undefined variable
Theere is no 'output' key in the kwargs, so if this was it it would
result in an exception. Mypy spotted this in a branch I'm working on
full typing for gnome, but since that seems unlikely to be done before
the 0.60 branchpoint I'd like to get this in sooner
2021-10-08 08:44:30 -04:00
Luca Bacci 6d1e182476 Windows module: Make path flattening for windres work in more cases
If either 'name' or 'name_formatted' are absolute paths,
then they are of the form:

C:\path/to/file.ext                            (example)

By only substituting slashes with the underscore, we get:

C:_path_to_file.ext

This is still not quite right, infact os.path.basename()
returns:

_path_to_file.ext

Also replace colons with underscores to overcome issues when
absolute paths are involved.
2021-10-07 21:52:18 -04:00
Dylan Baker bcfbfbb343 modules/gnome: deprecate yelp variadic sources
Yelp currently can take sources two different ways, the first is via
variadic arguments, the second is by a keyword argument. If the keyword
is passed then the variadic arguments are silently ignored, which is
obviously not ideal. Fortunately the variadic form was never documented,
and is likely not in wide use.

This patch fixes it by deprecating the variadic form, and warning if
both are passed. It does not change behavior as someone may be relying
on it.
2021-10-07 09:26:35 -07:00
Dylan Baker 4c00e63574 modules/external_project: use typed_kwargs
Which resolves all of the remaining typing issues.
2021-10-04 19:33:43 -07:00
Dylan Baker f228e0244b mdoules/external_project: fix most of the mypy warnings/errors 2021-10-04 19:33:43 -07:00
Dylan Baker 7c3f256b14 modules/external_project: clean up and sort modules 2021-10-04 19:33:43 -07:00
Eli Schwartz d06cc042eb
f-strings 2021-10-04 16:29:32 -04:00
Eli Schwartz e8a85fa8a2
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only"

and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted

Also catch a few creeping cases of new code added using older styles.
2021-10-04 16:29:30 -04:00
Jussi Pakkanen 2d65472c72
Merge pull request #8960 from mensinda/yamlDoc
Reference Manual 2.0
2021-10-04 22:19:07 +03:00
Dan Streetman 3c2cca5699 modules/i18n: fix gettext use of --datadirs param
The previous commit bd2fcb268b
accidentally used the wrong var so the param name was missing,
leading to an error of "unrecognized arguments" for the
datadirs parameter value.
2021-10-03 16:23:46 -04:00
Eli Schwartz 7825a6f2ca cmake module: if cmake cannot be found, do not traceback
We ended up passing a NoneType as the program binary, which is a very
awkward way to communicate an error when failing to write a basic
package version file.
2021-10-03 12:34:01 +02:00
Daniel Mensinger 7cfe7ccc58
docs: Hook up the new RefMan generator to Meson 2021-10-03 11:46:34 +02:00
Dylan Baker bd2fcb268b modules/i18n: Fix remaining mypy spotted issues 2021-09-30 16:09:14 -07:00
Dylan Baker 6399544e4c modules/i18n: use typed_kwargs for gettext
There were two allowed kwargs that were unused, I've dropped them for
now, though I need to check if they were documented. If they are then we
need to deprecate them to remove them, otherwise we'll just leave them
removed.
2021-09-30 16:09:14 -07:00
Dylan Baker 6b1a80024c modules/i18n: Use typed_kwargs for merge_file 2021-09-30 16:09:14 -07:00
Dylan Baker 61f2866a9f modules/i18n: use typed_pos_args 2021-09-30 16:09:14 -07:00
Dylan Baker b923163109 modules/i18n: add easy type annotations 2021-09-30 16:09:14 -07:00
Dylan Baker 57d0d4e95a modules/i18n: sort and clean up imports 2021-09-30 16:09:14 -07:00
Dylan Baker c4aa8c2521 modules: make ReturnValue.new_objects covariant
Otherwise we have to do a lot of casting to ensure that we get the
appropriate invariant type
2021-09-30 16:09:14 -07:00
Dylan Baker c3c30d4b06 interpreter: Use typed_kwargs for func_custom_target
This does not convert the build side, or remove any of the checking it
does. We still need that for other callers of custom target. What we'll
do for those is add an internal interface that defaults things, then
we'll be able to have those callers do their own validation, and the
CustomTarget validation machinary can be removed.

Fixes #9096
2021-09-30 21:01:38 +02:00
Xavier Claessens e836076e24 external-project: variables must be dict not list
Fixes: #9316
2021-09-29 19:01:44 -04:00
Filipe Laíns 05b5a1e56f modules: python: better handling of the Python paths for Debian
Hardcoding the name is fragile, and enabling it based on the existence of
/etc/debian_version (as the is_debianlike helper does) will result in
incorrect paths if the Python binary is not provided by Debian.

Using the deb_system distuils scheme instead makes sure we use the
install path from the current interpreter, which Debian could change
between releases, and gives us the correct value on Python installations
that are not provided by Debian (eg. deadsnakes, Github Action Python,
etc.)

Do notice, though, that there is still no guarantee that these are the
correct paths, as they assume all schemes paths have the install prefix
as a base, see #9284.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-29 08:54:05 -04:00
Dylan Baker 9795323b86 pylint: check for duplicate imports
I ran into one of these from LGTM, and it would be nice if pylint could
warn me as part of my local development process instead of waiting for
the CI to tell me.
2021-09-24 10:36:05 -07:00
Dylan Baker d661a0cd96 build: use an object rather than a dict for the dep_manifest
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-24 10:36:05 -07:00
Eli Schwartz 87e13af1c8
apply flake8 fixes for unused imports and missing imports 2021-09-14 15:55:07 -04:00
Eli Schwartz 2c34b2f063
fix traceback for undefined exception when trying to raise exception 2021-09-14 15:50:29 -04:00
Eli Schwartz f291b637b1
qt module: consolidate on one list of bins 2021-09-10 17:57:28 -04:00
Eli Schwartz d2bf77342e
qt module: fix regression in building translations via qresource
In commit 3c4c7d0429 the qresource
variable stopped being overwritten with a mesonlib.File, which is
reasonable. However, one call site for it which relied on being a built
file did not get renamed when needed.

Make the build target use the built file.
2021-09-10 17:57:28 -04:00
Eli Schwartz 7171d22f5f
qt module: correctly register a found tool and stop looking for it
Regression in commit d7ac2f1065 since
self.{tool_name} is not how it used to be tracked, and the "found"
dictionary is a legacy of the old location.
2021-09-10 17:57:28 -04:00
Filipe Laíns af8b55d49b mintro: add installed_plan
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-06 18:10:55 +02:00
Eli Schwartz 1dbb6d6b8c
make the display name of a gettext translation build, look prettier
And more accurate too, TBH. Currently it says it is building "lang.mo",
even though it is actually building "domain.mo" inside
lang/LC_MESSAGES/.

Since meson loudly complains if I try to name the display name
"lang/domain.mo", name it with a dash instead of a slash. The actual
name isn't a priority here IMO, and this is nicely readable.
2021-09-01 21:18:44 -04:00
Eli Schwartz 22c38a0006
i18n module: restore the <packagename>-gmo target
Removed in commit 487d45c1e5 but perhaps
it should not have -- people may have been depending on ensuring those
are built somehow. Even though the internal implementation changed and
it is now built by the all target, let's keep the old target around too.

Now it just aliases the actual build rules, though.
2021-08-31 23:37:33 -04:00
Eli Schwartz 2fc7592e13
i18n module: provide targets as return value for gettext()
Users may wish to make use of these files for their own purposes.

For example, the -pot and -update-po pseudo targets could be reused in
an alias_target(), and at least one person wanted to reuse the built .mo
files as custom_target input.

Fixes #6227
2021-08-31 23:37:33 -04:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
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-31 16:28:54 -04:00
Eli Schwartz 34ac77d619 python module: fix error message mentioning setuptools
We use distutils, not setuptools, for probing information.
2021-08-31 08:42:27 -07:00
Xavier Claessens 276063a1d2 Add missing "disabler" kwarg to python.dependency()
There is a unit test using it and now fails because the warning about
unknown kwarg became fatal.
2021-08-30 14:00:54 -04:00
Ting-Wei Lan a70cdebfe7 gnome: Prepend devenv, not append
Otherwise, if these environment variables already exist, they will
override values we set for the developer environment.
2021-08-29 08:36:59 -04:00
Dylan Baker 11fbaf29d8 interpreter: fix cases of `KwargInfo(..., T, default=None)`
The correct way to mark these is `KwargInfo(..., (T, type(None)))`.
There's also a few cases of `(T, None)` which is invalid, as `None`
isn't a type
2021-08-27 14:54:29 -07:00
Eli Schwartz 6170f1175e python module: produce the correct install path on every OS
The sysconfig paths are, by default, correct for every OS -- they are
supposed to follow the scheme that python knows about per default.

For some reason, this overrode the scheme to posix_prefix, which is the
default for posix OSes like linux and macOS, but wrong on Windows.
Simply deleting this entirely makes everything that used to work, still
work, and a couple new things start working.
2021-08-27 07:46:58 -04:00
Eli Schwartz 1dce556dc2 gnome: don't let fortify defines into the g-ir-scanner after stripping -O
The tool needs to run the preprocessor (but does not actually produce
compiled outputs), and meanwhile ignores lots of flags it doesn't think
it needs. In the case of -D_FORTIFY_SOURCE=...  this is only valid if -O
is there too, but otherwise spits out confusing warnings.

The warnings are spurious and can be safely ignored, but in this case
let's go the extra mile and fix g-ir-scanner's upstream bug by removing
the fortify flag first.

Fixes #9161
2021-08-23 21:01:16 -04:00