aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2021-06-25 21:14:27 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-06-26 12:49:35 +0200
commit8f7343831bb78e6801c93cd45e4edfeed65bc437 (patch)
treee90a37ac9b27584b8c43a32779330705973def02 /mesonbuild/interpreter/interpreter.py
parentb95d6e319f18389c3a11408481335955bdff4e36 (diff)
downloadmeson-8f7343831bb78e6801c93cd45e4edfeed65bc437.zip
meson-8f7343831bb78e6801c93cd45e4edfeed65bc437.tar.gz
meson-8f7343831bb78e6801c93cd45e4edfeed65bc437.tar.bz2
refactor: Refactor BothLibraries logic
This commit introduces a new type of `HoldableObject`: The `SecondLevelHolder`. The primary purpose of this class is to handle cases where two (or more) `HoldableObject`s are stored at the same time (with one default object). The best (and currently only) example here is the `BothLibraries` class.
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index d9ecd25..e4fb0d4 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -26,7 +26,7 @@ from ..programs import ExternalProgram, NonExistingExternalProgram
from ..dependencies import Dependency
from ..depfile import DepFile
from ..interpreterbase import ContainerTypeInfo, InterpreterBase, KwargInfo, typed_kwargs, typed_pos_args
-from ..interpreterbase import noPosargs, noKwargs, stringArgs, permittedKwargs, noArgsFlattening, unholder_return
+from ..interpreterbase import noPosargs, noKwargs, stringArgs, permittedKwargs, noArgsFlattening, noSecondLevelHolderResolving, unholder_return
from ..interpreterbase import InterpreterException, InvalidArguments, InvalidCode, SubdirDoneRequest
from ..interpreterbase import Disabler, disablerIfNotFound
from ..interpreterbase import FeatureNew, FeatureDeprecated, FeatureNewKwargs, FeatureDeprecatedKwargs
@@ -2537,8 +2537,6 @@ Try setting b_lundef to false instead.'''.format(self.coredata.options[OptionKey
sources = [sources]
results: T.List['SourceOutputs'] = []
for s in sources:
- if isinstance(s, build.BothLibraries):
- s = s.get_preferred_library()
if isinstance(s, str):
self.validate_within_subproject(self.subdir, s)
results.append(mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, s))
@@ -2713,6 +2711,7 @@ This will become a hard error in the future.''', location=self.current_node)
@noKwargs
@noArgsFlattening
+ @noSecondLevelHolderResolving
def func_set_variable(self, node, args, kwargs):
if len(args) != 2:
raise InvalidCode('Set_variable takes two arguments.')