From a524524ac0ac2b4a6d64346d234d43a855a3e5a6 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 2 Jul 2018 02:56:01 +0530 Subject: [PATCH] interpreter: Use is_subproject() everywhere --- mesonbuild/interpreter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 494cdb5ea..fc6588b58 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1697,7 +1697,7 @@ class MesonMain(InterpreterObject): @permittedKwargs({}) def is_unity_method(self, args, kwargs): optval = self.interpreter.environment.coredata.get_builtin_option('unity') - if optval == 'on' or (optval == 'subprojects' and self.interpreter.subproject != ''): + if optval == 'on' or (optval == 'subprojects' and self.interpreter.is_subproject()): return True return False @@ -3605,7 +3605,7 @@ different subdirectory. self.add_project_arguments(node, self.build.projects_link_args, args, kwargs) def add_global_arguments(self, node, argsdict, args, kwargs): - if self.subproject != '': + if self.is_subproject(): msg = 'Function \'{}\' cannot be used in subprojects because ' \ 'there is no way to make that reliable.\nPlease only call ' \ 'this if is_subproject() returns false. Alternatively, ' \ @@ -3710,7 +3710,7 @@ Try setting b_lundef to false instead.''') (num_sps, sproj_name) = self.evaluate_subproject_info(norm, self.subproject_dir) plain_filename = os.path.basename(norm) if num_sps == 0: - if self.subproject == '': + if not self.is_subproject(): return raise InterpreterException('Sandbox violation: Tried to grab file %s from a different subproject.' % plain_filename) if num_sps > 1: