Added method to get current project name.

pull/579/head
Jussi Pakkanen 9 years ago
parent 16e032c289
commit 144565fabf
  1. 4
      mesonbuild/interpreter.py
  2. 2
      test cases/common/49 subproject/meson.build
  3. 2
      test cases/common/49 subproject/subprojects/sublib/meson.build

@ -837,6 +837,7 @@ class MesonMain(InterpreterObject):
'add_postconf_script' : self.add_postconf_script_method,
'install_dependency_manifest': self.install_dependency_manifest_method,
'project_version': self.project_version_method,
'project_name' : self.project_name_method,
})
def add_install_script_method(self, args, kwargs):
@ -933,6 +934,9 @@ class MesonMain(InterpreterObject):
def project_version_method(self, args, kwargs):
return self.build.dep_manifest[self.interpreter.active_projectname]['version']
def project_name_method(self, args, kwargs):
return self.interpreter.active_projectname
class Interpreter():
def __init__(self, build, backend, subproject='', subdir='', subproject_dir='subprojects'):

@ -2,6 +2,8 @@ project('subproj user', 'c',
version : '2.3.4',
license : 'mylicense')
assert(meson.project_name() == 'subproj user', 'Incorrect project name')
sub = subproject('sublib', version : '1.0.0')
if meson.project_version() != '2.3.4'

@ -6,6 +6,8 @@ if not meson.is_subproject()
error('Claimed to be master project even though we are a subproject.')
endif
assert(meson.project_name() == 'subproject', 'Incorrect subproject name')
if meson.project_version() != '1.0.0'
error('Incorrect version string in subproject.')
endif

Loading…
Cancel
Save