Projects can specify a license which is written to the dep manifest.

pull/320/head
Jussi Pakkanen 9 years ago
parent a4809cf632
commit 278339855d
  1. 6
      interpreter.py
  2. 4
      test cases/common/49 subproject/meson.build
  3. 4
      test cases/common/49 subproject/subprojects/sublib/meson.build

@ -872,7 +872,7 @@ class MesonMain(InterpreterObject):
self.build.dep_manifest_name = args[0] self.build.dep_manifest_name = args[0]
def project_version_method(self, args, kwargs): def project_version_method(self, args, kwargs):
return self.build.dep_manifest[self.interpreter.active_projectname] return self.build.dep_manifest[self.interpreter.active_projectname]['version']
class Interpreter(): class Interpreter():
@ -1377,7 +1377,9 @@ class Interpreter():
self.parse_default_options(kwargs['default_options']) self.parse_default_options(kwargs['default_options'])
self.active_projectname = args[0] self.active_projectname = args[0]
self.project_version = kwargs.get('version', 'undefined') self.project_version = kwargs.get('version', 'undefined')
self.build.dep_manifest[args[0]] = self.project_version license = mesonlib.stringlistify(kwargs.get('license', 'unknown'))
self.build.dep_manifest[args[0]] = {'version': self.project_version,
'license': license}
if self.subproject in self.build.projects: if self.subproject in self.build.projects:
raise InvalidCode('Second call to project().') raise InvalidCode('Second call to project().')
if not self.is_subproject() and 'subproject_dir' in kwargs: if not self.is_subproject() and 'subproject_dir' in kwargs:

@ -1,4 +1,6 @@
project('subproj user', 'c', version : '2.3.4') project('subproj user', 'c',
version : '2.3.4',
license : 'mylicense')
sub = subproject('sublib', version : '1.0.0') sub = subproject('sublib', version : '1.0.0')

@ -1,4 +1,6 @@
project('subproject', 'c', version : '1.0.0') project('subproject', 'c',
version : '1.0.0',
license : ['sublicense1', 'sublicense2'])
if not meson.is_subproject() if not meson.is_subproject()
error('Claimed to be master project even though we are a subproject.') error('Claimed to be master project even though we are a subproject.')

Loading…
Cancel
Save