diff --git a/python-ecosys/astpp/astpp.py b/python-ecosys/astpp/astpp.py new file mode 100644 index 000000000..9fecb60d0 --- /dev/null +++ b/python-ecosys/astpp/astpp.py @@ -0,0 +1,38 @@ +try: + from micropython import const +except ImportError: + + def const(x): + return x + + +def keep(obj): + return obj + + +def omit(obj): + return None + + +def keep_if(cond): + return keep if cond else omit + + +def omit_if(cond): + return omit if cond else keep + + +try: + import micropython as _real_mpy +except ImportError: + _real_mpy = None +if _real_mpy is not None: + micropython = _real_mpy +else: + + class _MicroPythonShim: + native = staticmethod(keep) + viper = staticmethod(keep) + + micropython = _MicroPythonShim() +__version__ = "0.1.3" diff --git a/python-ecosys/astpp/manifest.py b/python-ecosys/astpp/manifest.py new file mode 100644 index 000000000..19f3350bb --- /dev/null +++ b/python-ecosys/astpp/manifest.py @@ -0,0 +1,3 @@ +metadata(version="0.1.3", pypi="astpp") + +module("astpp.py")