aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-06-01 20:48:35 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-06-15 12:48:53 -0700
commitd2c1ab40a0c94209d8e13886f3c7d697d30f2507 (patch)
treeb1d1d6600aaea3942e001036ad8504cc34f09ad1 /mesonbuild/build.py
parent2ac9b323918e8c61c4707fbd79d45cf1c6eecfd0 (diff)
downloadmeson-d2c1ab40a0c94209d8e13886f3c7d697d30f2507.zip
meson-d2c1ab40a0c94209d8e13886f3c7d697d30f2507.tar.gz
meson-d2c1ab40a0c94209d8e13886f3c7d697d30f2507.tar.bz2
interpreter|build: Pass just the executable down to Generator
This requires that the interpreter has done the validation, which it now does at all callsites. This simplifies the Generator initializer.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index a685664..c401bd2 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1498,12 +1498,7 @@ You probably should put it in link_with instead.''')
return
class Generator:
- def __init__(self, args, kwargs):
- if len(args) != 1:
- raise InvalidArguments('Generator requires exactly one positional argument: the executable')
- exe = unholder(args[0])
- if not isinstance(exe, (Executable, programs.ExternalProgram)):
- raise InvalidArguments('First generator argument must be an executable.')
+ def __init__(self, exe: T.Union['Executable', programs.ExternalProgram], kwargs):
self.exe = exe
self.depfile = None
self.capture = False
@@ -1514,7 +1509,7 @@ class Generator:
repr_str = "<{0}: {1}>"
return repr_str.format(self.__class__.__name__, self.exe)
- def get_exe(self):
+ def get_exe(self) -> T.Union['Executable', programs.ExternalProgram]:
return self.exe
def process_kwargs(self, kwargs):