# HG changeset patch # User Paul Boddie # Date 1384526807 -3600 # Node ID 87db7d860e4e070af69a5b87a00b378949c4b85b # Parent 11e442323fc68e3af3bd437f0ddd7327e88f316a Added a module to verify that an appropriate compiler module is being used. diff -r 11e442323fc6 -r 87db7d860e4e micropython/common.py --- a/micropython/common.py Fri Nov 15 13:15:30 2013 +0100 +++ b/micropython/common.py Fri Nov 15 15:46:47 2013 +0100 @@ -19,8 +19,8 @@ this program. If not, see . """ +from micropython.stdcompiler import compiler from compiler.ast import AssAttr, Getattr, Name -import compiler.ast from micropython.basicdata import Const, Constant, TypedInstance from micropython.data import BaseAttr, Class, Module from micropython.errors import * diff -r 11e442323fc6 -r 87db7d860e4e micropython/deduce.py --- a/micropython/deduce.py Fri Nov 15 13:15:30 2013 +0100 +++ b/micropython/deduce.py Fri Nov 15 15:46:47 2013 +0100 @@ -22,7 +22,6 @@ from micropython.common import * from micropython.data import * from micropython.errors import * -import compiler.ast # Source code classes. diff -r 11e442323fc6 -r 87db7d860e4e micropython/inspect.py --- a/micropython/inspect.py Fri Nov 15 13:15:30 2013 +0100 +++ b/micropython/inspect.py Fri Nov 15 15:46:47 2013 +0100 @@ -75,7 +75,7 @@ from micropython.common import ASTVisitor, operator_functions, get_module_name from micropython.data import * from micropython.errors import * -import compiler.ast +from micropython.stdcompiler import compiler import sys class NullBranch(compiler.ast.AttributeUser): diff -r 11e442323fc6 -r 87db7d860e4e micropython/report.py --- a/micropython/report.py Fri Nov 15 13:15:30 2013 +0100 +++ b/micropython/report.py Fri Nov 15 15:46:47 2013 +0100 @@ -23,7 +23,7 @@ from micropython.data import * from micropython.errors import * from os.path import exists, extsep, join -import compiler.ast +from micropython.stdcompiler import compiler import sys import os import textwrap diff -r 11e442323fc6 -r 87db7d860e4e micropython/stdcompiler.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/micropython/stdcompiler.py Fri Nov 15 15:46:47 2013 +0100 @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +""" +Compiler module import control. + +Copyright (C) 2013 Paul Boddie + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +""" + +import compiler.ast + +if not hasattr(compiler.ast, "AttributeUser"): + raise SystemError, "The compiler module must support micropython " \ + "annotations. See the documentation for more " \ + "information." + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 11e442323fc6 -r 87db7d860e4e micropython/syspython.py --- a/micropython/syspython.py Fri Nov 15 13:15:30 2013 +0100 +++ b/micropython/syspython.py Fri Nov 15 15:46:47 2013 +0100 @@ -23,7 +23,7 @@ from micropython.data import * from micropython.errors import * from os.path import exists, extsep, join -import compiler.ast +from micropython.stdcompiler import compiler import sys import os