aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-08-06 16:08:42 -0700
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-08-20 18:57:19 +0200
commit4d6f15b1f198f48c5c6b78fd3a3829027d7a497c (patch)
tree7960c92ea2b8d8f1ecde74dc24b0e842980ab8a5
parentb7ebccd25737a3b5eefb40fa734271470a8f8c95 (diff)
downloadmeson-4d6f15b1f198f48c5c6b78fd3a3829027d7a497c.zip
meson-4d6f15b1f198f48c5c6b78fd3a3829027d7a497c.tar.gz
meson-4d6f15b1f198f48c5c6b78fd3a3829027d7a497c.tar.bz2
environment: add annotations and fix get_meson_command
It is theoretically possible for the command to be None so we should handle that.
-rw-r--r--mesonbuild/environment.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 5d27a2c..dbf0d4e 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -22,7 +22,7 @@ from . import mesonlib
from .mesonlib import (
MesonException, EnvironmentException, MachineChoice, Popen_safe, PerMachine,
PerMachineDefaultable, PerThreeMachineDefaultable, split_args, quote_arg, OptionKey,
- search_version
+ search_version, MesonBugException
)
from . import mlog
from .programs import (
@@ -750,8 +750,12 @@ class Environment:
def get_coredata(self) -> coredata.CoreData:
return self.coredata
- def get_build_command(self, unbuffered=False):
- cmd = mesonlib.get_meson_command().copy()
+ @staticmethod
+ def get_build_command(unbuffered: bool = False) -> T.List[str]:
+ cmd = mesonlib.get_meson_command()
+ if cmd is None:
+ raise MesonBugException('No command?')
+ cmd = cmd.copy()
if unbuffered and 'python' in os.path.basename(cmd[0]):
cmd.insert(1, '-u')
return cmd