Age | Commit message (Collapse) | Author | Files | Lines |
|
Thankfully the typing module provides us an immutable protocol for
mappings, so we don't have to write one ourselves.
|
|
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
```
|
|
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
|
|
On mac this appears to default to c++98, which in turn falls over with
boost that requires at least c++11
|
|
CMake toolchain file improvements (fixes #8293)
|
|
|
|
|
|
|
|
|
|
This will allow adding "forced-off" Feature objects in the next patch.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
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>
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Instead of guessing the internal compiler
variables, Meson now runns CMake once to
determine what they actually are.
|
|
- handle cached CMake variables differently
- associate variables with source files
- better performance (str to Path and generator expressions)
|
|
When meson has setup the VS environment, running ninja to build won't
work, user should use meson wrapper to compile.
|
|
|
|
|
|
|
|
This fix calling random internal methods from meson.build as long as
they were not prefixed by underscore.
|
|
It is only needed in functions that need to add targets to the
interpreter.
|
|
Custom objects returned by modules must be subclass of ModuleObject and
have the state argument in its methods.
Add MutableModuleObject base class for objects that needs to be deep
copied on assignation.
|
|
The only advantage they have is they have the interpreter in arguments,
but it's already available as self.interpreter. We should discourage
usage of the interpreter API and rely on ModuleState object instead in
the future.
This also lift the restriction that a module method cannot add build
targets, but that was not enforced for snippet methods anyway (and some
modules were doing it) and it's really loose restriction as it should
check for many other things if we wanted to make it consistent.
|
|
|
|
Got the Idea from setuptools
https://github.com/pypa/setuptools/blob/a5131f0b82e098da6c07a03a47f36f3a52f73fb6/setuptools/msvc.py#L176
|
|
It was previously an hard error, only permitted since 0.59.0.
|
|
|
|
configuration
|
|
|
|
|
|
This way if we're doing a host == build configuration then the build and
host dependencies will be stored correctly.
|
|
|
|
Otherwise it'll except when it tries to get an attribute from None that
doesn't exist.
|
|
|
|
|
|
We need to pass any generated sources down the CustomTarget
inititalizers so that they will generate a dependency correctly,
otherwise we get race conditions.
|
|
The pre-2015 Visual Studio IDE do not handle things correctly for this test,
so disable this.
|
|
This will test the "whole archive" and "generator link whole" for all
Visual C++ versions.
|
|
...Update 2, to be exact, since the Visual Studio linker only gained the
`/WHOLEARCHIVE:` feature since Visual Studio 2015 Update 2.
This checks whether we have the corresponding `cl.exe` which is
versioned at or after Visual Studio 2015 Update 2 before we try to apply
the `/WHOLEARCHIVE:xxx` linker flag. If we aren't, use built-in methods
in Meson to grab the object files of the dependent static lib's, along
with the objects that were `link_whole:`'ed into them, and feed this
list into the linker instead.
This would make `link_whole:` work on Visual Studio 2015 Update 1 and
earlier, including previous Visual Studio versions.
|
|
|
|
|
|
|
|
|
|
|
|
|