On 7 May 2014 19:46, Lluís Vilanova <vilan...@ac.upc.edu> wrote: > The primitive uses JSON syntax, and include paths are relative to the file > using the directive: > > { 'include': 'path/to/file.json' } > > Signed-off-by: Lluís Vilanova <vilan...@ac.upc.edu> > Reviewed-by: Eric Blake <ebl...@redhat.com> > Reviewed-by: Markus Armbruster <arm...@redhat.com>
> @@ -74,10 +91,33 @@ class QAPISchema: > self.accept() > > while self.tok != None: > - expr_info = {'fp': fp, 'line': self.line} > - expr_elem = {'expr': self.get_expr(False), > - 'info': expr_info} > - self.exprs.append(expr_elem) > + expr_info = {'file': input_relname, 'line': self.line, 'parent': > self.parent_info} > + expr = self.get_expr(False) > + if isinstance(expr, dict) and "include" in expr: > + if len(expr) != 1: > + raise QAPIExprError(expr_info, "Invalid 'include' > directive") > + include = expr["include"] > + if not isinstance(include, str): > + raise QAPIExprError(expr_info, > + 'Expected a file name (string), got: > %s' > + % include) > + include_path = os.path.join(self.input_dir, include) > + if any(include_path == elem[1] > + for elem in self.include_hist): > + raise QAPIExprError(expr_info, "Inclusion loop for %s" > + % include) > + try: > + fobj = open(include_path, 'r') > + except IOError as e: Hi. I'm afraid "except ... as" is only supported in Python 2.6, and we have to support Python 2.4 still (as Andreas mentioned in another thread this breaks compilation on MacOSX 10.5). Please can you fix this to use the older syntax (cf also commit 21e0043bad which fixed an earlier instance of this problem)? thanks -- PMM