Commit Graph

113 Commits

Author SHA1 Message Date
a53c6687b6 fully type mconf.py 2023-06-25 10:08:15 -04:00
b411be5edc fully type mdist.py 2023-06-25 10:08:15 -04:00
b01ae087f5 cargo: Add a builder module to the cargo package
This is a helper, currently only used by cargo. It could be moved later
if there are other users.
2023-06-07 19:20:30 -07:00
2d26c272c3 run_mypy: accept the path to an alternative mypy executable
mypy might be installed with a different python than the one run_mypy.py
is using.
2023-03-02 15:52:45 -05:00
3946f1eb17 Revert "target python 3.10 as the mypy language version"
This reverts commit 0b7d935a84.

The issue is fixed in mypy 1.0.0 now.
2023-03-02 15:51:27 -05:00
6c3b0973c4 run_mypy: passthrough unknown options to mypy itself
Useful for running as a thin wrapper in other contexts that expect the
ability to run mypy itself with arbitrary arguments.
2023-03-02 15:33:19 -05:00
2d0c9ce5f2 properly type utils/core.py and add it to mypy
EnvironmentVariables was always broken, it used MutableMapping because
everyone <3 abstract interfaces, especially when they are broken and
don't actually do what you want.

This needs a dict interface, exposing `.copy()`. We either use a dict or
os._Environ, and the latter also supports that.

Also fix a broken import, and the fallout from forgetting to update the
signature of self.envvars in commit b926374205.
2023-01-16 15:30:12 -05:00
6ed6c8cdba modules: fully type the Qt* modules
The base module is fully typed, but the numbered version are not, though
it's pretty trivial to do so.
2023-01-10 09:53:22 -08:00
e8a88f5320 modules: add type annotations to the __init__ module 2023-01-10 09:53:22 -08:00
0b7d935a84 target python 3.10 as the mypy language version
mypy has a bug when running on/for 3.11 which results in incorrect
analysis of the codebase, specifically due to enum.Enum's self.name

See:

https://github.com/python/typeshed/issues/7564
https://github.com/python/mypy/issues/12483
2022-11-06 12:20:36 -05:00
4e374d5cef run_mypy: add extra logging and permit specifying files to check
If those files are not yet known to be typed, skip them. This makes it
possible to trivially check a shortlist of files that were just changed
and see if they regress our mypy coverage. Ideal for use in a git
pre-commit hook.
2022-10-24 00:37:51 -04:00
2dfd952eb9 Move classes used by scripts to their own module
Those classes are used by wrapper scripts and we should not have to
import the rest of mesonlib, build.py, and all their dependencies for
that.

This renames mesonlib/ directory to utils/ and add a mesonlib.py module
that imports everything from utils/ to not have to change `import
mesonlib` everywhere. It allows to import utils.core without importing
the rest of mesonlib.
2022-09-28 19:36:13 -04:00
4135925b60 run_mypy: Add modules/pkgconfig to the list of checked modules 2022-08-18 21:57:36 -04:00
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
0bf66ff02c modules/wayland: Add full type checking 2022-07-17 12:58:17 -04:00
4acab57d47 modules/icestorm: use type checking 2022-05-23 23:32:47 -04:00
10fc19ecb4 modules: add typing to the modtest module 2022-05-23 23:32:47 -04:00
a6e08e8fa7 use a more sane check instead of run_custom_lint
Unfortunately, checking for strings without context is exceedingly prone
to false positives, while missing anything that indirectly opens a file.

Python 3.10 has a feature to warn about this though -- and it uses a
runtime check which runs at the same time that the code fails to open
files in the broken Windows locale. Set this up automatically when
running the testsuite.

Sadly, Python's builtin feature to change the warning level, e.g. by
setting EncodingWarning to error at startup, is utterly broken if you
want to limit it to only certain modules. This is tracked in order to be
more efficiently ignored at https://bugs.python.org/issue34624 and
https://github.com/python/cpython/pull/9358

It is also very trigger happy and passing stuff around via environment
variable either messes with the testsuite, or with thirdparty programs
which are implemented in python *such as lots of gnome*, or perhaps
both.

Instead, add runtime code to meson itself, to add a hidden "feature".
In the application source code, running the 'warnings' module, you can
actually get the expected behavior that $PYTHONWARNINGS doesn't have. So
check for a magic testsuite variable every time meson starts up, and if
it does, then go ahead and initialize a warnings filter that makes
EncodingWarning fatal, but *only* when triggered via Meson and not
arbitrary subprocess scripts.
2022-03-01 21:42:52 -05:00
57c8e1a780 run_mypy: add sourceset module 2022-02-23 10:18:34 -08:00
9b04257847 run_mypy: add gnome module 2022-01-18 21:58:24 -05:00
fe51450970 depfile: type annotate 2022-01-10 23:06:20 -05:00
69fa37e9ca Merge pull request #9623 from dcbaker/submit/keyval-typeing
Add type annotations and typed_pos_args to the keyval module
2021-11-28 18:34:10 +02:00
b361fc52dd Add typing to msubprojects.py 2021-11-28 07:10:12 -05:00
e38c4defcb run_mypy: add modules/keyval 2021-11-23 13:20:40 -08:00
cc231de08e modules/windows: use typed_kwargs 2021-10-09 21:34:48 -07:00
246d5f34bb run_mypy: Add the external_project_module 2021-10-04 19:33:43 -07:00
ad65a699f9 docs: Initial reference manual generator 2021-10-03 11:46:34 +02:00
bd2fcb268b modules/i18n: Fix remaining mypy spotted issues 2021-09-30 16:09:14 -07:00
92b21a0045 interpreter/mesonmain: Fix remaining typing problems and add to run_mypy 2021-09-24 10:36:05 -07:00
8d92e6d865 interpreter: Add IntegerHolder 2021-08-31 23:01:21 +02:00
be92e37837 Add Java module
The Java module will serve as a source for easing Java development
within Meson. Currently it only supports generating native header files.
2021-08-22 07:57:29 -07:00
a0e2de02bf run_mypy: add backends/backends 2021-08-20 18:57:19 +02:00
8e2890f6c0 run_mypy: add interpreter/compiler.py 2021-08-16 16:21:51 -07:00
5381ec89af run_mypy: Add interpreter/type_checking to the list of checked modules 2021-08-04 19:09:08 -04:00
c0a2025d03 tests: test that we always set encoding 2021-06-29 11:28:08 +02:00
3e396b3782 fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
0f237b8d1d linkers: move linkers.py into the linkers package 2021-06-25 19:34:48 +02:00
7c757dff71 holders: Fix the remaining code to respect the holder changes 2021-06-18 23:48:33 +02:00
6fb2f86379 Merge pull request #8822 from dcbaker/submit/annotate-and-check-qt-module
Rewrite the Qt module for type safety!
2021-06-16 20:11:46 +03:00
3824e30f7a modules/qt: fix remaining typing issues and add to run_mypy
This just ignores the fact taht Generator is unchecked. Generator needs
some real love in terms of type checking.
2021-06-15 12:36:05 -07:00
2eabcae9b5 run_mypy: lower required version to 0.812
I've run this against Meson and it has no spurious errors. I suspect
that all versions >= .8 are fine, but I didn't test those.
2021-06-13 21:29:02 -07:00
97bedd015f run_mypy: Check mypy version to avoid spurious errors 2021-06-11 23:03:43 +02:00
ad584f022d interpreter: Move interpreterbase.py into a new package 2021-06-11 10:42:18 +02:00
7fc755b334 typing: Fully annotate run_project_tests.py 2021-06-09 13:25:36 +02:00
15b69d0421 typing: Fully annotate dependencies 2021-06-09 09:46:37 +02:00
30e329aac9 typing: Fully annotate dependencies.framework 2021-06-06 21:30:02 +03:00
25875ae0d3 typing: Fully annotate dependencies.{detect,factory} + some other fixes 2021-06-06 20:30:24 +03:00
71906c4bf8 typing: Fully annotate dependencies.cmake 2021-06-06 20:02:48 +03:00
125566b329 typing: Fully annotate dependencies.platform 2021-06-06 19:40:35 +03:00
96473085e0 typing: Fully annotate dependencies.dub 2021-06-06 19:40:35 +03:00