Commit Graph

207 Commits

Author SHA1 Message Date
Daniel Mensinger 2d8da3cb11 interpreter: Fix missing featuer check (fixes #9425) 2021-10-24 09:58:20 -04:00
Eli Schwartz f52a5a7cd3
wrap: move FeatureNew checks to a more natural place
Now, warnings are unconditionally raised when parsing the wrap file,
whether they are used or not. That being said, these warnings literally
just check for a couple of keys used in the .wrap ini file.

Moving these checks from the time of use to the time of loading, means
that we no longer report warnings only when originally downloading or
extracting the file or VCS repo.

It also means we no longer report warnings in one subproject, when a
wrap file is picked up from a different subproject because the first
subproject actually does a dependency lookup. This caused issues for the
WrapDB tooling, which uses patch_directory everywhere and the
superproject requires a suitable minimum version of meson for this...
but individual wraps might use a much lower version, and would then
raise a warning (in strict mode, converted to an error) when it resolved
a dependency from another WrapDB project.

Fixes #9118
2021-10-15 14:38:44 -04:00
Daniel Mensinger 220d5aa7ba interpreter: Fix missing holder entry (fixes #9389) 2021-10-12 12:44:33 -04:00
Xavier Claessens 928078982c Add --vsenv command line option and active VS only when needed 2021-10-10 23:15:18 +03:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Eli Schwartz ba432c87a4 Revert "interpreter: Add FeatureNew check"
This reverts commit c0efa7ab22.

This was a nice idea, or a beautiful hack depending on your perspective.
Unfortunately, it turns out to be a lot harder than we originally
thought. By operating on bare nodes, we end up triggering a FeatureNew
on anything that isn't a string literal, rather than anything that
isn't a string.

Since no one else has come up with a better idea for implementing a
FeatureNew, let's just revert it. Better to not have a warning, than
have it trigger way too often.
2021-10-10 16:59:18 +02:00
Jussi Pakkanen 95d8b8787a Be more strict about target names with slashes. 2021-10-10 15:01:53 +03:00
Xavier Claessens 2628ce576c Add support for module options 2021-10-08 17:47:35 -04:00
Eli Schwartz 108bd996ee
add install_emptydir function
This replaces the absolute hack of using

```
install_subdir('nonexisting', install_dir: 'share')
```

which requires you to make sure you don't accidentally or deliberately
have a completely different directory with the same name in your source
tree that is full of files you don't want installed. It also avoids
splitting the name in two and listing them in the wrong order.

You can also set the install mode of each directory component by listing
them one at a time in order, and in fact create nested structures at
all.

Fixes #1604
Properly fixes #2904
2021-10-08 14:35:00 -04:00
Daniel Mensinger dfec4385a7 interpreter: Move RangeHolder out of interpreterbase to interpreter 2021-10-06 22:37:18 +02:00
Daniel Mensinger af0587cb49 interpreter: Holderify arrays and dicts
This is the final refactoring for extracting the bultin object
logic out of Interpreterbase. I decided to do both arrays and
dicts in one go since splitting it would have been a lot more
confusing.
2021-10-06 22:37:18 +02:00
Eli Schwartz d06cc042eb
f-strings 2021-10-04 16:29:32 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -04:00
Eli Schwartz f2eb1534dd
work around flake8 F811 for T.overload redefined functions
Since typing != T as far as flake8 is aware, give the linter an extra
hint.
2021-10-04 16:29:31 -04:00
Eli Schwartz 1bb2523e58
remove f from f-string that has no formatting 2021-10-04 16:29:31 -04:00
Eli Schwartz e33ba28ec4
better error message for modules returning the wrong value 2021-10-04 16:29:30 -04:00
Eli Schwartz e8a85fa8a2
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only"

and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted

Also catch a few creeping cases of new code added using older styles.
2021-10-04 16:29:30 -04:00
Jussi Pakkanen 2d65472c72
Merge pull request #8960 from mensinda/yamlDoc
Reference Manual 2.0
2021-10-04 22:19:07 +03:00
Zbigniew Jędrzejewski-Szmek 75dd9fb67f interpreter: improve the error message about install_mode
We wrote:
 ERROR: install_emptydir keyword argument "install_mode" permissions string must
        be exactly 9 characters, got "4" in the form rwxr-xr-x

Let's change this around to be easier to read.

Also, 1-based numbering was used (for components) and 0-based for "bits".
And actually the "bits" are not bits, but octal digits. So say "permissions
character 1", "permissions character 2".

And finally change "must be … if provided" to "can only be". (If it isn't
provided, it "is not", so the sentence is still valid. The user will only
get this error if they provide something, so we don't need to be super precise
and say "if provided". And then we avoid confusing the reader whether
it's "if provided" attaches to the the "False" or to the whole sentence.)
2021-10-04 10:31:21 -04:00
Daniel Mensinger c10e228371
docs: Fixes found during the YAML conversion process 2021-10-03 11:51:37 +02:00
Dylan Baker 3bb962975e interpreter: move some of CustomTarget's args to type_checking
As there are so many wrappers that need these as well
2021-09-30 16:09:14 -07:00
Xavier Claessens 4deeb907b6 dependency: Allow searching for multiple names 2021-09-30 17:49:15 -04:00
Dylan Baker c3c30d4b06 interpreter: Use typed_kwargs for func_custom_target
This does not convert the build side, or remove any of the checking it
does. We still need that for other callers of custom target. What we'll
do for those is add an internal interface that defaults things, then
we'll be able to have those callers do their own validation, and the
CustomTarget validation machinary can be removed.

Fixes #9096
2021-09-30 21:01:38 +02:00
Dylan Baker 74819dbd2a interpreter: Allow FileMode to be passed to _get_kwarg_install_mode
This will happen as we transition from doing the conversion in the
function body to using the KwargInfo to make that change. If we get one
just return it.
2021-09-30 21:01:38 +02:00
Dylan Baker 3bb6d56dcd interpreter: move command kwarg to type_checking 2021-09-30 21:01:38 +02:00
Dylan Baker 3374b7c323 interpreter/type_checking: Add DEPEND_FILES_KW
since most of the Target classes use this, let's just go ahead and add
it here instead of moving it later
2021-09-30 21:01:38 +02:00
Dylan Baker a3e63a4269 interpreter: move KwargInfo('depends') to type_checking 2021-09-30 21:01:38 +02:00
Dylan Baker 16986f1853 interpreter: DEPFILE_KW should be Optional[str] 2021-09-30 21:01:38 +02:00
Dylan Baker 0f6d6c914a interpreter: remove duplicate permittedKwargs
func_generator already has typed_kwargs, it doesn't need both.
2021-09-30 21:01:38 +02:00
Dylan Baker d9c32f32d1 interpreter: move DEPFILE_KW to type_checkingt 2021-09-30 21:01:38 +02:00
Dylan Baker cb762f29fe interpreter: use typed_kwargs on func_run_target 2021-09-30 21:01:38 +02:00
Xavier Claessens d2fa6d5080 Make custom_target() name argument optional 2021-09-30 12:26:19 -04:00
Jussi Pakkanen fa47d8dab0
Merge pull request #9014 from bonzini/mixed-language-link
Use appropriate compiler for the source file for "links" tests with file argument
2021-09-28 17:32:44 +03:00
Eli Schwartz 941b8a6dbc
fix message function accepting bools and casting to string
This was allowed by accident despite what meson said would work, because
in python a bool counts as a subclass of int.
2021-09-26 23:23:07 -04:00
Daniel Mensinger c0efa7ab22 interpreter: Add FeatureNew check 2021-09-25 12:44:11 +02:00
Daniel Mensinger 6b00c7dc81 Remove helpers.check_stringlist() 2021-09-25 12:44:11 +02:00
Daniel Mensinger d93d01b6c5 interpreter: Introduce StringHolder
Another commit in my quest to rid InterpreterBase from all higher
level object processing logic.

Additionally, there is a a logic change here, since `str.join` now
uses varargs and can now accept more than one argument (and supports
list flattening).
2021-09-25 12:44:11 +02:00
Jussi Pakkanen fee5cb697c
Merge pull request #9167 from dcbaker/submit/meson-main-type-checking
Add type annotations and type checking to meson main
2021-09-24 23:40:52 +03:00
Dylan Baker 68c23a6120 Add option to to transpile Cython to C++
This patch adds a new meson built-in option for cython, allowing it to
target C++ instead of C as the intermediate language. This can, of
course, be done on a per-target basis using the `override_options`
keyword argument, or for the entire project in the project function.

There are some things in this patch that are less than ideal. One of
them is that we have to add compilers in the build layer, but there
isn't a better place to do it because of per target override_options.
There's also some design differences between Meson and setuptools, in
that Meson only allows options on a per-target rather than a per-file
granularity.

Fixes #9015
2021-09-24 22:56:46 +03:00
Dylan Baker 5a69dbe0cb interpreter/mesonmain: remove unreachable code
Now that we have type checking, we can be sure that this code is
unreachable, and remove it.
2021-09-24 10:36:05 -07:00
Dylan Baker 92b21a0045 interpreter/mesonmain: Fix remaining typing problems and add to run_mypy 2021-09-24 10:36:05 -07:00
Dylan Baker d661a0cd96 build: use an object rather than a dict for the dep_manifest
This really is more of a struct than a dict, as the types are disjoint
and they are internally handled, (ie, not from user input). This cleans
some things up, in addition I spotted a bug in the ModuleState where the
dict with the version and license is passed to a field that expects just
the version string.
2021-09-24 10:36:05 -07:00
Dylan Baker 6c5bfd4c24 interpreter/mesonmain: Add full set of typed_argument guards 2021-09-24 09:48:47 -07:00
Dylan Baker 27fd7b14e7 interpreter/mesonmain: fix type annotations
Taht should have been converted to build/program module objects, not
interpterter objects
2021-09-24 09:47:38 -07:00
Dylan Baker 88e5ff0575 interpreter: Add a few missing type annotations
Just enough to make interpreter/mesonmain happy
2021-09-24 09:47:36 -07:00
Andrea Pappacoda 68eca11cc6 Use -Oz when optimization=s in Clang
-Oz is the appropriate flag to use when you want to produce the smallest
possible binary, and is one would expect when setting optimization to s
or using the minsize build type.
2021-09-21 09:58:48 -07:00
Xavier Claessens 30f24bfa32 dependency: If cached version is outdated, look on system again
Fixes: #9271
2021-09-20 16:42:11 -04:00
Xavier Claessens e9386e80ae dependencyfallbacks: Use default_options for implicit fallbacks
This removes the warning when using default_options without fallback
kwarg completely because a subproject does not know if the main project
has an implicit fallback or not, so it could set default_options even if
not fallback is available at all.

Fixes: #9278
2021-09-20 13:42:07 -04:00
Paolo Bonzini 8596b3bcd1 interpreter: detect and pass compiler to be used for linker tests
Allow using the links method to test that the C++ driver (e.g. g++) can be used to
link C objects.  One usecase is that the C compiler's libsanitizer might not be
compatible with the one included by the C++ driver.

This is theoretically backwards-incompatible, but it should be treated as a
bugfix in my opinion. There is no way in Meson to compile a .c file with the
C++ driver as part of a build target, therefore there would be no reason to
do something like meson.get_compiler(meson.get_compiler('cpp').links(files('main.c')).

Fixes: #7703
2021-09-07 14:18:33 +02:00
Filipe Laíns af8b55d49b mintro: add installed_plan
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-06 18:10:55 +02:00