aboutsummaryrefslogtreecommitdiff
path: root/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-08-23 20:13:53 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-08-23 20:13:53 +0300
commit7c6e99149bc742ba0e98521907a690a526bb894c (patch)
tree4dcf692e90528f719f0ed3dacd558769429621cd /interpreter.py
parent0384fa9175c3b0e8f7671ffc2a5b1292c4cd5874 (diff)
parent5ffe46bc6a09461b046c3deefbf5ed9d84a0c5c1 (diff)
downloadmeson-7c6e99149bc742ba0e98521907a690a526bb894c.zip
meson-7c6e99149bc742ba0e98521907a690a526bb894c.tar.gz
meson-7c6e99149bc742ba0e98521907a690a526bb894c.tar.bz2
Merge pull request #236 from mesonbuild/depmanifest2
Add version numbers to projects and generate a dep manifest.
Diffstat (limited to 'interpreter.py')
-rw-r--r--interpreter.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/interpreter.py b/interpreter.py
index 3443058..f270948 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -723,6 +723,8 @@ class MesonMain(InterpreterObject):
'source_root' : self.source_root_method,
'build_root' : self.build_root_method,
'add_install_script' : self.add_install_script_method,
+ 'install_dependency_manifest': self.install_dependency_manifest_method,
+ 'project_version': self.project_version_method,
})
def add_install_script_method(self, args, kwargs):
@@ -791,6 +793,16 @@ class MesonMain(InterpreterObject):
def is_subproject_method(self, args, kwargs):
return self.interpreter.is_subproject()
+ def install_dependency_manifest_method(self, args, kwargs):
+ if len(args) != 1:
+ raise InterpreterException('Must specify manifest install file name')
+ if not isinstance(args[0], str):
+ raise InterpreterException('Argument must be a string.')
+ self.build.dep_manifest_name = args[0]
+
+ def project_version_method(self, args, kwargs):
+ return self.build.dep_manifest[self.interpreter.active_projectname]
+
class Interpreter():
def __init__(self, build, subproject='', subdir='', subproject_dir='subprojects'):
@@ -1168,7 +1180,9 @@ class Interpreter():
subi.subprojects = self.subprojects
subi.subproject_stack = self.subproject_stack + [dirname]
+ current_active = self.active_projectname
subi.run()
+ self.active_projectname = current_active
mlog.log('\nSubproject', mlog.bold(dirname), 'finished.')
self.build.subprojects[dirname] = True
self.subprojects.update(subi.subprojects)
@@ -1202,11 +1216,11 @@ class Interpreter():
def func_project(self, node, args, kwargs):
if len(args) < 2:
raise InvalidArguments('Not enough arguments to project(). Needs at least the project name and one language')
- if list(kwargs.keys()) != ['subproject_dir'] and len(kwargs) != 0:
- raise InvalidArguments('project() only accepts the keyword argument "subproject_dir"')
if not self.is_subproject():
self.build.project_name = args[0]
+ self.active_projectname = args[0]
+ self.build.dep_manifest[args[0]] = kwargs.get('version', 'undefined')
if self.subproject in self.build.projects:
raise InvalidCode('Second call to project().')
if not self.is_subproject() and 'subproject_dir' in kwargs: