Commit Graph

1036 Commits

Author SHA1 Message Date
Xavier Claessens 9b8378985d cargo: Load Cargo.lock
Cargo.lock is essentially identical to subprojects/*.wrap files. When a
(sub)project has a Cargo.lock file this allows automatic fallback for
its cargo dependencies.
2024-06-14 15:59:42 -04:00
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.

This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.

SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
2023-12-13 15:19:21 -05:00
Benoit Pierre 268276f7ac tests: fix assertion rewriting when pytest is used 2023-08-18 00:37:40 -04:00
Dylan Baker 4017dab484 cargo/cfg: Add a parser for the rust/cargo cfg() expressions
This uses a recursive descent parser + lexer to create an IR from cfg()
expressions, which it then converts into meson IR.
2023-06-07 19:20:30 -07:00
Dylan Baker 5e59e5a9e4 cargo/version: add a function to convert cargo versioning to meson 2023-06-07 19:20:30 -07:00
Eli Schwartz d37002a5f5 run_unittests: check for pytest and pytest-xdist separately
Do not quit from using pytest at all, when pytest is present, simply
because xdist isn't available. Even without xdist, pytest is still
useful.

There doesn't seem to be any particular reason to require xdist. It just
happens to have been implemented that way, back in commit
4200afc74d when we originally added a
check to avoid pytest erroring out with unknown options when xdist
options are passed and xdist is not installed.
2022-02-14 14:46:01 +05:30
Eli Schwartz 81a2c1b36d
remove unused imports 2021-10-26 20:53:43 -04:00
Xavier Claessens 928078982c Add --vsenv command line option and active VS only when needed 2021-10-10 23:15:18 +03:00
Xavier Claessens ea4b999473 Add platform agnostic tests
This adds a new category of tests that does not need to run on all
platforms during CI. For now only run them on Linux runners because they
are not the bottleneck.
2021-09-21 08:28:26 -04:00
Xavier Claessens 7eb4c23156 Split run_unittests.py file 2021-07-26 15:19:13 -04:00
Florian Schmaus dbf2ace6ca
coredata: throw a MesonException on unknown options
Fixes #7288.
2021-07-26 01:10:58 +03:00
Daniel Mensinger bf41d56597 ast: Add dummy "support" for fstrings in the ast package 2021-07-25 21:36:52 +03:00
Jussi Pakkanen 4703f4c244
Merge pull request #8992 from dcbaker/submit/modernize-python-module-dependency
Cleanup the python module
2021-07-22 01:16:24 +03:00
Jussi Pakkanen 0be74c7835
Merge pull request #8972 from bonzini/C-symlink
resolve symlinks passed to -C
2021-07-18 15:03:54 +03:00
Jussi Pakkanen 7dee480a40 Condense test directory names for next release. 2021-07-15 00:23:42 +03:00
Dylan Baker 20399a3e04 modules/pkgconfig: remove handling of .pcdep
Nothing uses this anymore, so don't check for it.
2021-07-13 16:43:14 -07:00
Paolo Bonzini b5146c02ef run_unittests: add test for passing symlinks to setup and test 2021-07-13 15:42:46 +02:00
Tristan Partin f21685a833 Delete redirected wrap files in subprojects purge
We need to store the original filename as well as whether the wrap was
redirected in order to properly purge the redirected wrap.
2021-07-03 13:14:20 +03:00
Tristan Partin 6f3f43bb2d Flatten test suite value
This behavior is more inline with the rest of Meson
2021-07-02 21:58:22 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Daniel Mensinger 28175bbee2
pathlib: Patch pathlib to work around some bugs (fixes #7295) 2021-06-29 11:28:08 +02:00
Daniel Mensinger 3f889606c7 Split compiler detection from Environment
This moves all the compiler detection logic into the new
compilers.detect module. This dramatically reduces the size
and complexity of Environment.
2021-06-25 19:34:48 +02:00
Jussi Pakkanen 6e0a0fd1da
Merge pull request #8884 from dcbaker/submit/type-and-annotate-install-functions
Add annotations for the various install_* functions
2021-06-23 01:00:59 +03:00
Daniel Mensinger 765aff5a42 coverage: Enable coverage reports 2021-06-22 21:05:11 +03:00
Dylan Baker dd296f321b interpreterbase: Add evolve to KwargInfo
This works just like OptionKey.evolve, pass new keyword arguments to
override old ones, otherwise the original versions are copied to the new
one.
2021-06-22 09:12:54 -07:00
Daniel Mensinger 34c28dc92c holders: remove unholder 2021-06-18 23:48:33 +02:00
Daniel Mensinger 66b32a4591 holders: Introduce HoldableObject 2021-06-18 23:48:33 +02:00
Daniel Mensinger b2112bc4f6 tests: Always enable the traceback in run_project_tests.py 2021-06-18 23:48:33 +02:00
Xavier Claessens fbeb62101c doc: Add missing modules to dropdown list 2021-06-17 11:28:01 +02:00
Xavier Claessens b6d754a40c interpreter: Extract dependency() logic into its own helper class
The dependency lookup is a lot of complex code. This refactor it all
into a single file/class outside of interpreter main class. This new
design allows adding more fallbacks candidates in the future (e.g. using
cc.find_library()) but does not yet add any extra API.
2021-06-16 19:04:03 -04:00
Dylan Baker 7535736108 docs: Use an include for the qt modules
Insteadf of qt4 referencing the Qt5 page, include the same content in
both.
2021-06-15 14:15:13 -07:00
Dylan Baker 5bb75dc3af interpreterbase: Add deprecated_values and since_values to KwargInfo
This allows checking specific values that are added or deprecated, which
we do a surprising amount of. This works with both containers and scalar
values
2021-06-14 12:30:02 -07:00
Dylan Baker 6490b13f22 run_unittests: mock meson global before changing
For safety
2021-06-14 12:30:02 -07:00
Daniel Mensinger e987a88c19 tests: Force colorize CI output 2021-06-09 13:25:36 +02:00
Jussi Pakkanen a4a61b6bf8
Merge pull request #8512 from bonzini/feature-methods
Utility methods for feature objects
2021-06-08 12:37:25 +03:00
Dylan Baker 6ab78b5979 intperperterbase: Add a convertor keyword argument
This is meant to allow simple type conversions to happen before the
interpreter function is called. This should simplify some cases like the
"native" keyword arugment that are booleans in the Meson DSL, but an
Enum in the implementation
2021-06-08 11:00:55 +02:00
Dylan Baker fb385728df interpreterbase: Add validator keyword argument to typed_kwargs
This attribute is a callable that returns a string if the value is
invalid, otherwise None. This intended for cases like the `install_*`
function's `install_mode` paramater, which is either an int or the
string "preserve", which allows us to do nice things like:

```python

class Kwargs(TypedDict):

    install_mode: T.Union[int, T.Literal['preserve']]

@typed_kwargs(
  'foo', KwargInfo('install_mode', ...,
  validator=lambda x: None if isinstance(x, int) or x == 'preserve' else 'must be the literal "preserve"),
)
def install_data(self, node, args, kwargs: 'Kwargs'):
  ...
```

In this case mypy *knows* that the string is preserve, as do we, and we
can simply do tests like:
```python
if kwargs['install_mode'] == 'preserve':
   ...
else:
   # this is an int
```
2021-06-08 11:00:55 +02:00
Dylan Baker 4dc3f2af63 run_unittests.py: Use mock for monkey patching
it's what mock is for afterall
2021-06-08 11:00:55 +02:00
Paolo Bonzini 6497e52035 run_unittests.sh: fix Python DeprecationWarning
Fix the following Python error:

  D:\a\1\s\run_unittests.py:6654: DeprecationWarning: invalid escape sequence \
    self.assertEqual(libhello_nolib.get_pkgconfig_variable(escaped_var, {}), hello world)

Use a raw string literal.
2021-06-08 10:18:12 +02: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
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
Xavier Claessens 16c3f03394 typed_kwargs: Add since and deprecated annotations 2021-06-01 20:01:20 -04:00
Dylan Baker 521b92e499 interpreterbase: Add a function for type checking keyword arguments 2021-05-30 23:32:15 -07:00
Jussi Pakkanen 2dc8d1d626 Fix text used to validate test output. 2021-05-23 17:58:56 +01:00
Jussi Pakkanen df960b0a35
Merge pull request #8786 from jon-turney/cygwin-tests-reenable
Re-enable various tests on Cygwin
2021-05-23 17:52:20 +01:00
Jussi Pakkanen cdb91f493e Disable D test on macOS as it fails mysteriously. 2021-05-23 11:26:53 +01:00
Jussi Pakkanen 293da38546 It seems ld64 is the default linker name on macOS now. 2021-05-23 11:26:53 +01:00
Jon Turney f76c6b8d0a
Fix LTO test on Cygwin
This partially reverts commit add502c648.

In 'linkshared' test, annotate cppfunc() as imported, so an indirection
through an import stub is generated, avoiding a relocation size error
when building using gcc for Cygwin with LTO on.

Align with the example of how to write this portably in [1].

The 'c' language part of that test already gets this right.

[1] http://gcc.gnu.org/wiki/Visibility
2021-05-21 14:19:35 +01:00
Xavier Claessens 69a5c950a3 pkgconfig: Do not escape custom variables
We need to escape space in variables that gets into cflags or libs
because otherwise we cannot split compiler args when paths contains
spaces. But custom variables are unlikely to be path that gets used in
cflags/libs, and escaping them cause regression in GStreamer that use
space as separator in a list variable.
2021-05-18 18:03:37 -04:00
Jussi Pakkanen 0b2a7300c0 Set up VS environment automatically when run. 2021-05-13 11:03:10 +03:00