Commit Graph

1204 Commits

Author SHA1 Message Date
Dylan Baker d5e899c768
pylint: enable the bad_builtin checker
This finds uses of deny-listed functions, which defaults to map and
filter. These functions should be replaced by comprehensions in
idiomatic python because:
    1. comprehensions are more heavily optimized and are often faster
    2. They avoid the need for lambdas in some cases, which make them
       faster
    3. you can do the equivalent in one statement rather than two, which
       is faster
    4. They're easier to read
    5. if you need a concrete instance (ie, a list) then you don't have
       to convert the iterator to a list afterwards
2022-11-29 23:26:05 -05:00
Olexa Bilaniuk 6190b6466e CUDA: Update minimum driver version table to include CUDA 11.8
Agrees with Release Notes, Section 1.1, Table 3.
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
2022-11-29 18:44:40 -05:00
Olexa Bilaniuk 5b5798310a CUDA: Bugfix to architectural limit checks.
The upper bound on the CUDA Compute Capability is not always known.
Avoid checking cuda_hi_limit_gpu_architecture if it remains undefined.
2022-11-29 18:44:40 -05:00
Olexa Bilaniuk c4f3589215 CUDA: Add Orin, Lovelace and Hopper architecture names for CUDA 11.8
Co-authored-by: David Seifert <soap@gentoo.org>
2022-11-29 18:44:40 -05:00
Eli Schwartz bf83274344
python module: fix broken non-embed dependency
The `py.dependency(embed: false)` method is supposed to consistently
provide a distutils-like `python.pc` / `python-embed.pc` interface
regardless of Python version. It handles both pkg-config and sysconfig
scraping. For the latter, we respect the value of self.link_libpython
as determined by distutils, and construct a fully custom dependency. For
the former, we blindly assume pkg-config is correct.

It isn't correct, not until Python 3.8 when embed was added. Before
then, we need to process the pkg-config dependency based on
link_libpython. We did this, but only inside the extension_module
method, which is obviously wrong.

Delete the special casing from extension_module, and handle it inside
the dependency.

Fixes #11097
2022-11-24 11:50:20 -05:00
Daniele Nicolodi 235f32f1a6 python: Use correct extension filename suffix on Python < 3.8.7
On Windows, in Python version prior to 3.8.7, the `sysconfig` modules
provides an extension filename suffix that disagrees the one returned
by `distutils.sysconfig`. Get the more awesome suffix from the latter
when building for a Python version known to present this issue.

Simplify the extension module filename suffix lookup to use the same
method used by `setuptools`.

Adjust project tests accordingly.

Fixes #10960.
2022-11-23 07:29:23 -05:00
Eli Schwartz e5ce7f0770 hotdoc module: fix broken include paths
Since commit 32b14b1bb5, hotdoc is run
during configure as an external program. It turns out though, that in
some cases we passed NoneType in the cmd array, previously to
hotdoc.run_hotdoc.run() and now via subprocesses. The former "worked"
due to ignoring unknown arguments (?) but the latter was broken because
command line interfaces don't accept python NoneType objects, naturally.

End result: when for example building Meson's own documentation, this
fails with a python traceback.

The reason this happens to begin with turns out to be, once again,
because of the legacy debt of homebrewed kwargs parsing. We have a
function for `process_known_args` that handles args and ignores them if
they are NoneType, and then include_paths is handled via a custom
processor that internally adds them, then returns a *list* of NoneType
which then gets appended to the global cmd, because the logic ends up as
`[None, None] is None` which is a failed check, so we go ahead and add
it.

It's odd that we ever attempted to process it twice to begin with, so
let's simply not do that.
2022-11-20 23:08:44 +02:00
Eli Schwartz e0240515a6 hotdoc module: remove homebrew function-proxied OrderedSet
We are just using this dictionary to get keys, and we could also just
set it ourselves but with None values. But we have a code abstraction
for this already; use it.
2022-11-20 23:08:44 +02:00
Dylan Baker c642a7693e modules/rust: stabilize
Mesa is using the rust module in production, so we should stabilize
it.
2022-11-19 23:00:53 +02:00
Dylan Baker 8526b8c1a9 modules/rust: Also include generated sources for tests
When we create a test from a non-executable, we weren't copying the
generated sources, just the static ones.
2022-11-17 19:07:15 -05:00
Eli Schwartz 32b14b1bb5
hotdoc module: run hotdoc as an external command during configure
We need to run it as an external command at build time anyway, and we
detect it by looking it up as an ExternalProgram. It seems odd to then
import it into Meson's python interpreter and run the main function.

Moreover, this errors out when you are running two different pythons,
one for Meson and one for hotdoc. For example, when hotdoc is installed
normally, but you're testing Meson against a nondefault newer version of
python.
2022-11-17 16:17:40 -05:00
Hagen Möbius 6860e42c06 Raise an error, if the file element in a resource file has no text.
- minor cleanups in the vicinity
2022-11-14 00:26:55 +02:00
Eli Schwartz bcc127b3fd hotdoc module: add dedicated depends kwarg, deprecate file deps in dependencies
We consistently use the "dependencies" kwarg to refer to C-like
CFLAGS/LDFLAGS interfaces. And for hotdoc, we actually accept libraries
for this as well, as we may want to document their (generated?) sources,
so we want their CFLAGS too.

But we also accepted custom targets and just added a build order
dependency on these, which was odd and typically we call that "depends".
Let's deprecate this in favor of the depends kwarg.
2022-11-07 09:19:56 -05:00
Eli Schwartz 726353460a hotdoc module: use less confusing names
Internally we pass this as extra_depends to the CustomTarget
initializer, so it makes sense to call it that rather than confusing the
topic by referring to "dependencies", a term that indicates
CFLAGS/LDFLAGS interfaces.
2022-11-07 09:19:56 -05:00
Paolo Bonzini 212af2b278 gnome: allow generator outputs as gdbus-codegen inputs
GeneratedLists as sources to `gnome.gdbus_codegen` worked until
version 0.60 of Meson, but broke in 0.61 because of the conversion to
typed_pos_args and typed_kwargs.  Reinstate this by adding them to the
decorators and annotations.

Note that gdbus_codegen desugars to two custom_targets and therefore the
generator is invoked twice.  This is not optimal, but it should not be
an issue and can be changed later.

Fixes: 53a187ba2 ("modules/gnome: use typed_pos_args for gdbus_codegen", 2021-11-01)
Fixes: ef52e6093 ("modules/gnome: use typed_kwargs for gdbus_codegen", 2021-11-08)
2022-10-28 13:06:52 +03:00
Paolo Bonzini 2fe3271f77 gnome: allow custom targets as gdbus-codegen inputs
Custom targets as sources to `gnome.gdbus_codegen` worked until version 0.60
of Meson, but broke in 0.61 because of the conversion to typed_pos_args
and typed_kwargs.  Reinstate this by adding custom targets to the
decorators and annotations.

While generators also used to work, they are a bit tricky because
gdbus_codegen desugars to two custom_targets and therefore the generator
is invoked twice.  This should not be a problem, but be explicit and
leave that to a separate commit to highlight the problem.

Fixes: 53a187ba2 ("modules/gnome: use typed_pos_args for gdbus_codegen", 2021-11-01)
Fixes: ef52e6093 ("modules/gnome: use typed_kwargs for gdbus_codegen", 2021-11-08)
2022-10-28 13:06:52 +03:00
Eli Schwartz c8aecc7685 hotdoc module: add partially typed kwargs
We accept a list of known kwargs of required types, but also arbitrary
kwargs understood by the hotdoc program (sometimes via extensions). Now
that we can partially type-check kwargs, do so here.
2022-10-24 15:16:02 +03:00
Nirbheek Chauhan 7912901acc hotdoc: Fix typo in argument 2022-10-14 05:14:46 +05:30
Dylan Baker df1b95cf2b
pylint: enable consider-merging-isinstance 2022-10-04 00:33:14 -04:00
Dylan Baker a72840cd2e
pylint: enable use-a-generator
This catches some optimization problems, mostly in the use of `all()`
and `any()`. Basically writing `any([x == 5 for x in f])` vs `any(x == 5
for x in f)` reduces the performance because the entire concrete list
must first be created, then iterated over, while in the second f is
iterated and checked element by element.
2022-10-04 00:33:04 -04:00
Dylan Baker 20d76b8353
pylint: enable unnecessary-comprehension 2022-10-03 00:14:43 -04:00
Paolo Borelli a58ec322b3 gnome: add support for update-mime-database
Fixes https://github.com/mesonbuild/meson/issues/10865
2022-09-28 12:07:24 -04:00
Jan Tojnar c8d5f93cb0 gnome/yelp: fix `xml:lang` attributes
itstool detects a language code from the mo file’s basename,
so when 26c1869a14
changed the file name to be prefixed with project name,
values like “my-project-xx” ended up in the `xml:lang` attribute
of the generated page files, instead of the expected
IETF BCP 47 language tag.

Let’s fix it by passing a locale code to itstool explicitly.
2022-09-27 22:04:45 +03:00
Dylan Baker 1917b9253e modules/gnome: make_native_glib_version an instance var
This removes the need for the use of the global statement. I've also
updated the test that overrides this to use mock.patch instead of hand
monkey patching.
2022-09-22 18:17:43 -04:00
Eli Schwartz eb69fed2f6
python module: allow specifying the pure kwarg in the installation object
Fixes #10523
2022-09-19 21:13:37 -04:00
Dylan Baker 188c552dcf pylint: enable use-maxsplit-arg
This finds a bunch of places where we can do more efficient string
splitting.
2022-09-19 20:57:52 -04:00
Eli Schwartz 5bfab845d0
compilers: directly import from subpackages
It turns out we don't generally need to proxy every compiler ever
through the top-level package. The number of times we directly poke at
one is negligible and direct imports are pretty clean.
2022-09-19 15:19:00 -04:00
Xavier Claessens 635cb1b873 gnome: Add some missing install_tag 2022-09-18 21:59:30 -04:00
David Ward ee5a729190 modules: Fix paths to (sub)project source/build directories
The subproject directory name (i.e. 'subprojects') was being added
to the path even for the main project.
2022-09-12 00:27:21 -04:00
David Ward 68add86f7b i18n: Fix source root in Gettext targets for subprojects
Gettext should search for input files relative to the (sub)project
source root, not the global source root.

This change exposes a root_subdir member in ModuleState.
2022-09-12 00:27:21 -04:00
Mark Bolhuis a289e5416b modules/wayland: Change default value of include_core_only to true
The use of wayland-<client|server>.h is discouraged, therefore
change the default value of include_core_only to true.
2022-09-07 08:43:29 -04:00
Mark Bolhuis b6235a2e42 modules/wayland: Rename core_only to include_core_only
Rename the core_only option in scan_xml to include_core_only
to match the flag used by wayland-scanner.
2022-09-07 08:43:29 -04:00
Mark Bolhuis 25f838fd33 modules/wayland: Support --include-core-only
wayland-scanner can generate header files that only include
wayland-client-core.h using a flag.

Add a core_only option to scan_xml to support this use case.
2022-09-06 18:08:39 -04:00
Thomas Li a4d5442207 Fix install_subdirs not showing up in intro-install_plan.json 2022-09-06 02:09:38 -04:00
Jehan a692395186 Fix 2 typos in a single string which can be shown in error messages. 2022-08-31 21:20:47 -04:00
aleksander e121cd123c modules/cmake: Fix typo 2022-08-31 17:32:39 +03:00
Alf Henrik Sauge 28dff2ca6d Fix indentation issues reported by flake8, requiring code restructuring
Strictly speaking code restructuring isn't needed, but making this PEP8
compliant results in indentation of the code that reduces the
readability. By moving the offending code on the outside of the method
call, the readability is maintained.
2022-08-26 17:12:40 -04:00
Alf Henrik Sauge 06bf9a5cda Fix purely white space issues reported by flake8 2022-08-26 17:12:40 -04:00
Eli Schwartz 47a0ed5924
Revert "Windows: Improve Python 3.8+ module check on Windows"
This reverts commit 99ad11bd9c.

This breaks working setups in conda. It is either wrong or incomplete
and thus cannot be used.

Fixes #10737
2022-08-25 17:41:38 -04:00
Eli Schwartz 3e73d4d77d
introspection: untangle install_plan implemetation, fix a bunch of wrong ones
Generally plumb through the values of get_option() passed to
install_dir, and use this to establish the install plan name. Fixes
several odd cases, such as:

- {datadir} being prepended to "share" or "include"

- dissociating custom install directories and writing them out as
  {prefix}/share/foo or {prefix}/lib/python3.10/site-packages

This is the second half of #9478
Fixes #10601
2022-08-22 14:15:22 -04:00
Dylan Baker a572734330 modules/pkgconfig: make it a NewExtensionModule
Since we no longer need Interpreter.extract_variables, we can remove the
interpreter from the module!
2022-08-18 21:57:36 -04:00
Dylan Baker 7c12066e73 modules/pkgconfig: mypy clean! 2022-08-18 21:57:36 -04:00
Dylan Baker 9bd3c1957d modules/pkgconfig: Fix code to handle CustomTarget and CustomTargetIndex 2022-08-18 21:57:36 -04:00
Dylan Baker 2fb0c0e4d8 modules/pkgconfig: remove type checking abstraction
Which confuses the heck out of mypy
2022-08-18 21:57:36 -04:00
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