Commit Graph

15 Commits

Author SHA1 Message Date
Xavier Claessens 273605f859 Fix since annotation for str "in" operator 2022-11-08 20:48:32 +02:00
Xavier Claessens a6db624aad Implement `in` operator on string 2022-11-06 17:22:00 +02:00
Eli Schwartz e19e9ce6f1
interpreter: add a special class to track the lifecycle of get_option() strings 2022-08-22 11:46:34 -04:00
Eli Schwartz 462b35e4b1 flake8: fix various whitespace nits 2022-06-13 13:34:39 +03:00
Eli Schwartz df3f064c81
dependencies: move DependencyVariableString handling to declare_dependency
This allows tracking which subproject it came from at the time of
definition, rather than the time of use. As a result, it is no longer
possible for one subproject which knows that another subproject installs
some data files, to expose those data files via its own
declare_dependency.
2022-04-13 17:28:01 -04:00
Eli Schwartz 0e3ed2f655
dependencies: allow get_variable to expose files from subprojects
There are somewhat common, reasonable and legitimate use cases for a
dependency to provide data files installed to /usr which are used as
command inputs. When getting a dependency from a subproject, however,
the attempt to directly construct an input file from a subproject
results in a sandbox violation. This means not all dependencies can be
wrapped as a subproject.

One example is wayland-protocols XML files which get scanned and used to
produce C source files.

Teach Meson to recognize when a string path is the result of fetching a
dep.get_variable(), and special case this to be exempt from subproject
violations.

A requirement of this is that the file must be installed by
install_data() or install_subdir() because otherwise it is not actually
representative of what a pkg-config dependency would provide.
2022-04-13 17:28:01 -04:00
Eli Schwartz c231c4bd2a
move a bunch of imports into TYPE_CHECKING blocks
These are only used for type checking, so don't bother importing them at
runtime.

Generally add future annotations at the same time, to make sure that
existing uses of these imports don't need to be quoted.
2022-03-07 19:09:50 -05:00
Eli Schwartz cf3a1d31f8 fix some flake8 violations for unused imports
And one undefined T.cast name in a file that isn't yet mypy-ready
anyway.
2022-01-27 10:48:01 -08:00
Eli Schwartz 558f9fed9e
fix regression that broke string.format with list objects
String formatting should validly assume that printing a list means
printing the list itself. Instead, something like this broke:

'one is: @0@ and two is: @1@'.format(['foo',  'bar'], ['baz'])

which would evaluate as:

'one is: foo and two is: bar'

or:

'the value of array option foobar is: @0@'.format(get_option('foobar'))

which should evaluate with '-Dfoobar=[]' as

'the value of array option foobar is: []'

But instead produced:

meson.build:7:0: ERROR: Format placeholder @0@ out of range.

Fixes #9530
2021-11-04 18:57:14 -04:00
Daniel Mensinger 0fea9965ad interpreter: Revert old path joining behavior (fixes #9450) 2021-10-26 15:16:11 -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
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -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