|
|
@ -17,6 +17,7 @@ |
|
|
|
import parser |
|
|
|
import parser |
|
|
|
import nodes |
|
|
|
import nodes |
|
|
|
import environment |
|
|
|
import environment |
|
|
|
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
|
|
class InterpreterException(Exception): |
|
|
|
class InterpreterException(Exception): |
|
|
|
pass |
|
|
|
pass |
|
|
@ -168,6 +169,7 @@ class Interpreter(): |
|
|
|
self.variables = {} |
|
|
|
self.variables = {} |
|
|
|
self.environment = build.environment |
|
|
|
self.environment = build.environment |
|
|
|
self.build_func_dict() |
|
|
|
self.build_func_dict() |
|
|
|
|
|
|
|
self.subdir = '' |
|
|
|
|
|
|
|
|
|
|
|
def build_func_dict(self): |
|
|
|
def build_func_dict(self): |
|
|
|
self.funcs = {'project' : self.func_project, |
|
|
|
self.funcs = {'project' : self.func_project, |
|
|
@ -178,7 +180,8 @@ class Interpreter(): |
|
|
|
'shared_library' : self.func_shared_lib, |
|
|
|
'shared_library' : self.func_shared_lib, |
|
|
|
'add_test' : self.func_add_test, |
|
|
|
'add_test' : self.func_add_test, |
|
|
|
'headers' : self.func_headers, |
|
|
|
'headers' : self.func_headers, |
|
|
|
'man' : self.func_man |
|
|
|
'man' : self.func_man, |
|
|
|
|
|
|
|
'subdir' : self.func_subdir |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def sanity_check_ast(self): |
|
|
|
def sanity_check_ast(self): |
|
|
@ -286,6 +289,16 @@ class Interpreter(): |
|
|
|
self.build.man.append(m) |
|
|
|
self.build.man.append(m) |
|
|
|
return m |
|
|
|
return m |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def func_subdir(self, node, args): |
|
|
|
|
|
|
|
self.validate_arguments(args, 1, [str]) |
|
|
|
|
|
|
|
prev_subdir = self.subdir |
|
|
|
|
|
|
|
self.subdir = os.path.join(prev_subdir, args[0]) |
|
|
|
|
|
|
|
buildfilename = os.path.join(self.subdir, environment.builder_filename) |
|
|
|
|
|
|
|
code = open(os.path.join(self.environment.get_source_dir(), buildfilename)).read() |
|
|
|
|
|
|
|
assert(isinstance(code, str)) |
|
|
|
|
|
|
|
print('Going to subdirectory "%s".' % self.subdir) |
|
|
|
|
|
|
|
self.subdir = prev_subdir |
|
|
|
|
|
|
|
|
|
|
|
def build_target(self, node, args, targetclass): |
|
|
|
def build_target(self, node, args, targetclass): |
|
|
|
for a in args: |
|
|
|
for a in args: |
|
|
|
if not isinstance(a, str): |
|
|
|
if not isinstance(a, str): |
|
|
|