Commit Graph

11117 Commits

Author SHA1 Message Date
Dylan Baker b6eb5c231c build: Add type annotations for Generator
They're not 100% complete, but it's mostly there.
2021-06-07 09:15:09 -07: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
Jussi Pakkanen d13999f5b4
Merge pull request #8796 from xclaesse/wrapdbv2
wrap: Port to v2 protocol
2021-06-06 01:31:11 +03:00
Xavier Claessens 769fd50373 docs: Generate a table of all wrapdb releases
wrapdb CI will trigger Meson's CI to regenerate the list when
releases.json is updated.
2021-06-05 17:01:34 -04:00
Daniel Mensinger 240434b167 typing: Fully annotate dependencies.cuda 2021-06-05 12:35:48 +02:00
Daniel Mensinger 27bb5f536a typing: mlog use StringProtocol 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
Dylan Baker e0f62d1812 dependencies/detect: Add type annotations to find_external_dependency 2021-06-04 20:10:05 -07:00
Dylan Baker 6f562ed734 interpreterobjects: Fix type annotation for CustomTargetHolder 2021-06-04 20:10:05 -07:00
Dylan Baker ff0fd7d44c build: Add a type annotation to CustomTarget 2021-06-04 20:10:05 -07:00
Dylan Baker b107171307 interpreterbase: Allow safely using mutable default values with typed_kwargs
It's really inconvenient to want a thing that is always a list, but not
be able to provide a default value of a list because of mutation. To
that end the typed_kwargs method now makes a shallow copy of the default
when using a `ContainerTypeInfo` as the type. This mean that using a
default of `[]` is perfectly safe.
2021-06-04 20:10:05 -07:00
Dylan Baker 8890a62499 interpreterbase: fix type annotations for typed_pos_args
It takes a tuple of any length, for optargs and varargs, not a tuple of
length 1
2021-06-04 20:10:05 -07:00
Xavier Claessens 62c53b834d wrap: Port to v2 protocol
Fixes: #8754.
2021-06-04 15:35:29 -04:00
Daniel Mensinger df4d2bd247 typing: Fully annotate dependencies.base 2021-06-03 10:23:27 -07:00
Daniel Mensinger f502a38d1c typing: mlog: Simplify some typing with a TV_ variables 2021-06-03 10:23:27 -07:00
Daniel Mensinger 95b70bcb97 deps: Split dependencies.base
Split the Factory and dependency classes out
of the base.py script to improve maintainability.
2021-06-03 10:23:27 -07:00
Dylan Baker 201dc64226 add a couple more type annotations 2021-06-02 15:53:17 -07:00
Dylan Baker 145d92aa27 build: Use ImmutableSetProtocol for lru_cache'd value
To avoid mutation if possible.
2021-06-02 15:53:17 -07:00
Dylan Baker cfb847a1f0 build: use typing.Mapping for lru_cached dicts
Thankfully the typing module provides us an immutable protocol for
mappings, so we don't have to write one ourselves.
2021-06-02 15:53:17 -07:00
Dylan Baker 113a159514 use an immutable list for an lru_cached functions
When mutable items are stored in an lru cache, changing the returned
items changes the cached items as well. Therefore we want to ensure that
we're not mutating them. Using the ImmutableListProtocol allows mypy to
find mutations and reject them. This doesn't solve the problem of
mutable values inside the values, so you could have to do things like:

```python
ImmutableListProtocol[ImmutableListProtocol[str]]
```

or equally hacky. It can also be used for input types and acts a bit
like C's const:

```python
def foo(arg: ImmutableListProtocol[str]) -> T.List[str]:
    arg[1] = 'foo'  # works while running, but mypy errors
```
2021-06-02 15:53:17 -07:00
Dylan Baker f8be4f8fc7 adding a _typing module
this is a place that *must* only be imported inside a if
typing.TYPE_CHECKING block. It is a mixture of smoothing over thinigs
that moved from typing_extensions to typing in later python versions and
useful but typing only code.

This makes typing_extensions required for python versions older than
3.8 *when running mypy*. typing_extensions should *only* be imported
inside an `if typing.TYPE_CHECKING` block (include the new _typing.py
module) to ensure that it doesn't become a runtime dependency
2021-06-02 15:53:17 -07:00
Dylan Baker 023722b2c6 test cases/common/103 has header symbol: set c++ standard
On mac this appears to default to c++98, which in turn falls over with
boost that requires at least c++11
2021-06-02 23:02:42 +02:00
Jussi Pakkanen 99452dde26
Merge pull request #8812 from mensinda/cmakeToolchain
CMake toolchain file improvements (fixes #8293)
2021-06-02 22:31:32 +03:00
Jussi Pakkanen 83581f7fc1 Do not delete workdir in case scan-build fails. 2021-06-02 21:23:51 +03:00
Xavier Claessens 4516b7a8a9 docs: Fix typo in github pages repo URL 2021-06-02 10:55:43 -04:00
Xavier Claessens 4dec7dbb71 ci: Automatically update website when pushing to master 2021-06-02 17:39:34 +03:00
Xavier Claessens 16c3f03394 typed_kwargs: Add since and deprecated annotations 2021-06-01 20:01:20 -04:00
Paolo Bonzini 5298d8eaf1 interpreter: wrap access to Feature value
This will allow adding "forced-off" Feature objects in the next patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-31 16:01:57 +02:00
Paolo Bonzini 08a8043f19 interpreter: add feature.allowed()
This method simplifies the conversion of Feature objects to booleans.
Often, one has to use the "not" operator in order to treat "auto"
and "enabled" the same way.

"allowed()" also works well in conjunction with the require method that
is introduced in the next patch.  For example,

  if get_option('foo').require(host_machine.system() == 'windows').allowed() then
    src += ['foo.c']
    config.set10('HAVE_FOO', 1)
  endif

can be used instead of

  if host_machine.system() != 'windows'
    if get_option('foo').enabled()
      error('...')
    endif
  endif
  if not get_option('foo').disabled() then
    src += ['foo.c']
    config.set10('HAVE_FOO', 1)
  endif

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-31 16:01:57 +02:00
Dylan Baker 6aef800ba8 modules/fs: Use typed_kwargs 2021-05-30 23:32:15 -07:00
Dylan Baker 521b92e499 interpreterbase: Add a function for type checking keyword arguments 2021-05-30 23:32:15 -07:00
Daniel Mensinger 9b5463681e
cmake: select correct generator in toolchain.py 2021-05-30 16:33:09 +02:00
Naveen M K 7a6ad2953a Don't use `os.path.relpath` in dist command
This is problematic when we meson is installed in the different 
root(say C:) while building from another root(say D:).
This is how it is done in mesonpep517 and causes problems
because of that.
2021-05-30 00:49:43 +03:00
Dylan Baker c6ec13e6bf
Only try to get RSP syntax if RSP is supported (#8804) 2021-05-30 00:24:53 +03:00
Daniel Mensinger f0812baf8d
cmake: exclude generated files from the buildsystem files list 2021-05-29 17:31:19 +02:00
Daniel Mensinger 06f528a5b7
cmake: Update test case 2021-05-29 15:48:04 +02:00
Daniel Mensinger 49c730ef05
cmake: Fix CMakeToolchain (fixes #8293)
Instead of guessing the internal compiler
variables, Meson now runns CMake once to
determine what they actually are.
2021-05-29 13:20:25 +02:00
Daniel Mensinger 0e777e7c90
cmake: CMakeTraceParser improvements
- handle cached CMake variables differently
 - associate variables with source files
 - better performance (str to Path and generator expressions)
2021-05-29 13:20:25 +02:00
Xavier Claessens 25fa2d4f7b vsenv: Recommend using "meson compile" wrapper
When meson has setup the VS environment, running ninja to build won't
work, user should use meson wrapper to compile.
2021-05-28 17:34:25 -04:00
Jussi Pakkanen a9b65b421e Remove HFS workaround as everyone should use APFS by now. 2021-05-29 00:22:38 +03:00
Xavier Claessens 2fb24b18e1 unstable_external_project: Remove unused imports 2021-05-28 15:17:10 -04:00
Xavier Claessens 8abbc5cc5d modules: Replace find_program_impl() by state.find_program() 2021-05-28 15:17:10 -04:00
Xavier Claessens 2e02ef6592 modules: Add methods dict everywhere
This fix calling random internal methods from meson.build as long as
they were not prefixed by underscore.
2021-05-28 15:17:10 -04:00
Xavier Claessens a734bcfc83 modules: Stop using ModuleReturnValue where it's not needed
It is only needed in functions that need to add targets to the
interpreter.
2021-05-28 15:17:10 -04:00