Moved is_subproject into the meson object.

pull/15/head
Jussi Pakkanen 10 years ago
parent 1e12b87b93
commit 43f5166df2
  1. 8
      interpreter.py
  2. 2
      test cases/common/49 subproject/meson.build
  3. 2
      test cases/common/49 subproject/subprojects/sublib/meson.build

@ -568,6 +568,7 @@ class MesonMain(InterpreterObject):
'is_cross_build' : self.is_cross_build_method,
'has_exe_wrapper' : self.has_exe_wrapper_method,
'is_unity' : self.is_unity_method,
'is_subproject' : self.is_subproject_method,
'current_source_dir' : self.current_source_dir_method,
'current_build_dir' : self.current_build_dir_method,
'set_install_script' : self.set_install_script_method,
@ -631,6 +632,9 @@ class MesonMain(InterpreterObject):
def is_unity_method(self, args, kwargs):
return self.build.environment.coredata.unity
def is_subproject_method(self, args, kwargs):
return self.interpreter.subproject != ''
class Interpreter():
def __init__(self, build, subproject='', subdir=''):
@ -700,7 +704,6 @@ class Interpreter():
'option' : self.func_option,
'get_option' : self.func_get_option,
'subproject' : self.func_subproject,
'is_subproject' : self.func_is_subproject,
'pkgconfig_gen' : self.func_pkgconfig_gen,
}
@ -867,9 +870,6 @@ class Interpreter():
p = build.PkgConfigGenerator(libs, subdirs, name, description, version, filebase)
self.build.pkgconfig_gens.append(p)
def func_is_subproject(self, nodes, args, kwargs):
return self.subproject != ''
def func_subproject(self, nodes, args, kwargs):
if len(args) != 1:
raise InterpreterException('Subproject takes exactly one argument')

@ -2,7 +2,7 @@ project('subproj user', 'c')
sub = subproject('sublib')
if is_subproject()
if meson.is_subproject()
error('Claimed to be a subproject even though we are the master project.')
endif

@ -1,6 +1,6 @@
project('subproject', 'c')
if not is_subproject()
if not meson.is_subproject()
error('Claimed to be master project even though we are a subproject.')
endif

Loading…
Cancel
Save