aboutsummaryrefslogtreecommitdiff
path: root/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-08-21 20:50:40 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-08-21 22:11:44 +0300
commit5ffe46bc6a09461b046c3deefbf5ed9d84a0c5c1 (patch)
treee9a248f7d38d546d9d1ab9473b09cf382778a61d /interpreter.py
parent24d23c3086afe687cc93b26a07f504902f4a0b02 (diff)
downloadmeson-5ffe46bc6a09461b046c3deefbf5ed9d84a0c5c1.zip
meson-5ffe46bc6a09461b046c3deefbf5ed9d84a0c5c1.tar.gz
meson-5ffe46bc6a09461b046c3deefbf5ed9d84a0c5c1.tar.bz2
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 bc2f6f3..4202496 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: