Commit Graph

101 Commits

Author SHA1 Message Date
Dylan Baker 4135925b60 run_mypy: Add modules/pkgconfig to the list of checked modules 2022-08-18 21:57: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 0bf66ff02c modules/wayland: Add full type checking 2022-07-17 12:58:17 -04:00
Dylan Baker 4acab57d47 modules/icestorm: use type checking 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 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
Dylan Baker 57c8e1a780 run_mypy: add sourceset module 2022-02-23 10:18:34 -08:00
Dylan Baker 9b04257847 run_mypy: add gnome module 2022-01-18 21:58:24 -05:00
Dylan Baker fe51450970 depfile: type annotate 2022-01-10 23:06:20 -05:00
Jussi Pakkanen 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
Tristan Partin b361fc52dd Add typing to msubprojects.py 2021-11-28 07:10:12 -05:00
Dylan Baker e38c4defcb run_mypy: add modules/keyval 2021-11-23 13:20:40 -08:00
Dylan Baker cc231de08e modules/windows: use typed_kwargs 2021-10-09 21:34:48 -07:00
Dylan Baker 246d5f34bb run_mypy: Add the external_project_module 2021-10-04 19:33:43 -07:00
Daniel Mensinger ad65a699f9
docs: Initial reference manual generator 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 92b21a0045 interpreter/mesonmain: Fix remaining typing problems and add to run_mypy 2021-09-24 10:36:05 -07:00
Daniel Mensinger 8d92e6d865 interpreter: Add IntegerHolder 2021-08-31 23:01:21 +02:00
Tristan Partin 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
Dylan Baker a0e2de02bf run_mypy: add backends/backends 2021-08-20 18:57:19 +02:00
Dylan Baker 8e2890f6c0 run_mypy: add interpreter/compiler.py 2021-08-16 16:21:51 -07:00
Dylan Baker 5381ec89af run_mypy: Add interpreter/type_checking to the list of checked modules 2021-08-04 19:09:08 -04:00
Daniel Mensinger c0a2025d03
tests: test that we always set encoding 2021-06-29 11:28:08 +02:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Daniel Mensinger 0f237b8d1d linkers: move linkers.py into the linkers package 2021-06-25 19:34:48 +02:00
Daniel Mensinger 7c757dff71 holders: Fix the remaining code to respect the holder changes 2021-06-18 23:48:33 +02:00
Jussi Pakkanen 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
Dylan Baker 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
Dylan Baker 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
Xavier Claessens 97bedd015f run_mypy: Check mypy version to avoid spurious errors 2021-06-11 23:03:43 +02:00
Daniel Mensinger ad584f022d interpreter: Move interpreterbase.py into a new package 2021-06-11 10:42:18 +02:00
Daniel Mensinger 7fc755b334 typing: Fully annotate run_project_tests.py 2021-06-09 13:25:36 +02:00
Daniel Mensinger 15b69d0421 typing: Fully annotate dependencies 2021-06-09 09:46:37 +02:00
Daniel Mensinger 30e329aac9 typing: Fully annotate dependencies.framework 2021-06-06 21:30:02 +03:00
Daniel Mensinger 25875ae0d3 typing: Fully annotate dependencies.{detect,factory} + some other fixes 2021-06-06 20:30:24 +03:00
Daniel Mensinger 71906c4bf8 typing: Fully annotate dependencies.cmake 2021-06-06 20:02:48 +03:00
Daniel Mensinger 125566b329 typing: Fully annotate dependencies.platform 2021-06-06 19:40:35 +03:00
Daniel Mensinger 96473085e0 typing: Fully annotate dependencies.dub 2021-06-06 19:40:35 +03:00
Daniel Mensinger 6798bc8146 typing: Fully annotate dependencies.pkgconfig 2021-06-06 01:34:49 +03:00
Daniel Mensinger 240434b167 typing: Fully annotate dependencies.cuda 2021-06-05 12:35:48 +02:00
Daniel Mensinger 969ee9d85b typing: Fully annotate dependencies.configtool 2021-06-05 11:57:01 +02:00
Daniel Mensinger 1d0bd562f1 typing: Fully annotate dependencies.coarrays 2021-06-05 11:57:01 +02:00
Daniel Mensinger df4d2bd247 typing: Fully annotate dependencies.base 2021-06-03 10:23:27 -07:00
Dylan Baker 8771045d79 dependencies/qt: Add type annotations
And fix some style and correctness issues
2021-03-22 16:53:51 -07:00
Dylan Baker 97c1283baa programs: add type annotations 2021-03-19 08:47:10 -04:00
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -04:00
Dylan Baker 44c836e0d9 add a script to run a single test
As a Meson developer it's often frustrating to have a single functional
test with a regression. These tests can be awkward to reproduce,
especially when they make use of a test.json file. This script provides
a simmple interface to call functional tests 1 at a time, regardless of
whether they use a test.json or not. If they do use a test.json, and
have a matrix, then the `--subtest` option can be used to select spcific
combinations, for example:
```sh
./run_single_test.py "test cases/frameworks/15 llvm" --subtest 1
```
will run only the second (zero indexed of course) subtest from the llvm
test cases.

This is not a super elegent script, but this is super useful.
2021-02-23 09:08:55 -08:00
Dylan Baker 23d3b98fc1 split mesonlib into a package
Currently mesonlib does some import tricks to figure out whether it
needs to use windows or posix specific functions. This is a little
hacky, but works fine. However, the way the typing stubs are implemented
for the msvcrt and fnctl modules will cause mypy to fail on the other
platform, since the functions are not implemented.

To aleviate this (and for slightly cleaner design), I've split mesonlib
into a pacakge with three modules. A universal module contains all of
the platform agnositc code, a win32 module contains window specific
code, a posix module contains the posix specific code, and a platform
module contains no-op implementations. Then the package's __init__ file
imports all of the universal functions and all of the functions from the
approriate platform module, or the no-op versions as fallbacks. This
makes mypy happy, and avoids `if`ing all over the code to switch between
the platform specific code.
2021-01-23 12:48:29 +01:00
Dylan Baker 1849a9e9b7 run_mypy: add minstall 2021-01-13 13:32:48 -08:00
Dylan Baker 3d80a88bd3 modules: Add an unstable-rust module
Like other language specific modules this module is module for holding
rust specific helpers. This commit adds a test() function, which
simplifies using rust's internal unittest mechanism.

Rust tests are generally placed in the same code files as they are
testing, in contrast to languages like C/C++ and python which generally
place the tests in separate translation units. For meson this is
somewhat problematic from a repetition point of view, as the only
changes are generally adding --test, and possibly some dependencies.

The rustmod.test() method provides a mechanism to remove the repatition:
it takes a rust target, copies it, and then addes the `--test` option,
then creates a Test() target with the `rust` protocol. You can pass
additional dependencies via the `dependencies` keyword. This all makes
for a nice, DRY, test definition.
2021-01-05 15:10:50 -08:00