aboutsummaryrefslogtreecommitdiff
path: root/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2014-02-23 22:41:49 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2014-02-23 22:41:49 +0200
commitc3db9f4909060a89ab1243c2c5c28f420c46ad99 (patch)
tree280f14b6c85f42e9c992724e28359431a6180cc2 /interpreter.py
parent1f1a3f516e950cc8f49d7983f1127a2737c87a22 (diff)
downloadmeson-c3db9f4909060a89ab1243c2c5c28f420c46ad99.zip
meson-c3db9f4909060a89ab1243c2c5c28f420c46ad99.tar.gz
meson-c3db9f4909060a89ab1243c2c5c28f420c46ad99.tar.bz2
Some more subproject reorganisation.
Diffstat (limited to 'interpreter.py')
-rw-r--r--interpreter.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/interpreter.py b/interpreter.py
index 3976614..51b1ebc 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -610,6 +610,7 @@ class Interpreter():
self.visited_subdirs = {}
self.global_flags_frozen = False
self.subprojects = {}
+ self.subproject_stack = []
def build_func_dict(self):
self.funcs = {'project' : self.func_project,
@@ -795,10 +796,12 @@ class Interpreter():
raise InterpreterException('Subproject argument must be a string')
if self.subdir != '':
raise InterpreterException('Subprojects must be defined at the root directory.')
- if self.subproject != '':
- raise InterpreterException('Subprojects of subprojects are not yet supported.')
- if dirname in self.build.subprojects:
- raise InterpreterException('Tried to add the same subproject twice.')
+ if dirname in self.subproject_stack:
+ fullstack = self.subdir_stack + [dirname]
+ incpath = ' => '.join(fullstack)
+ raise InterpreterException('Recursive include of subprojects: %s.' % incpath)
+ if dirname == self.subprojects:
+ return self.subprojects[dirname]
subdir = os.path.join('subprojects', dirname)
abs_subdir = os.path.join(self.build.environment.get_source_dir(), subdir)
if not os.path.isdir(abs_subdir):
@@ -806,6 +809,7 @@ class Interpreter():
self.global_flags_frozen = True
mlog.log('\nExecuting subproject ', mlog.bold(dirname), '.\n', sep='')
subi = Interpreter(self.build, subdir)
+ subi.subproject_stack = self.subproject_stack + [subdir]
subi.run()
mlog.log('\nSubproject', mlog.bold(dirname), 'finished.')
self.build.subprojects[dirname] = True