Added copyright to all the MCPY files.

This commit is contained in:
SET 2020-08-19 21:24:52 -03:00
parent e9570ebe02
commit f34cedc4b4
5 changed files with 31 additions and 5 deletions

View File

@ -1,4 +1,11 @@
"""Install mcpy hooks to preprocess source files.
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Salvador de la Puente González
# Copyright (c) 2020 Salvador E. Tropea
# Copyright (c) 2020 Instituto Nacional de Tecnología Industrial
# License: MIT
# Project: MCPY https://github.com/delapuente/mcpy
"""
Install mcpy hooks to preprocess source files.
Actually, the library monkey-patches SourceFileLoader to compile the code
in a different way, providing the macro-expansion for the AST before compiling

View File

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Salvador de la Puente González
# Copyright (c) 2020 Salvador E. Tropea
# Copyright (c) 2020 Instituto Nacional de Tecnología Industrial
# License: MIT
# Project: MCPY https://github.com/delapuente/mcpy
""" Provide the functionality to find and expand macros. """
import sys
from ast import Name, copy_location, Import, alias, ImportFrom

View File

@ -1,3 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Salvador de la Puente González
# License: MIT
# Project: MCPY https://github.com/delapuente/mcpy
import ast
from .core import find_macros, expand_macros
@ -7,8 +11,8 @@ def nop(*args, **kw):
def source_to_xcode(self, data, path, *, _optimize=-1):
'''Intercepts the source to code transformation and expand the macros
before compiling to actual code.'''
"""Intercepts the source to code transformation and expand the macros
before compiling to actual code."""
tree = ast.parse(data)
module_macro_bindings = find_macros(tree, self.name)
expansion = expand_macros(tree, bindings=module_macro_bindings)

View File

@ -1,4 +1,8 @@
"""Usage: unparse.py <path to source file>"""
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Salvador de la Puente González
# License: MIT
# Project: MCPY https://github.com/delapuente/mcpy
""" Usage: unparse.py <path to source file> """
import sys
import ast
# import tokenize

View File

@ -1,4 +1,9 @@
# from functools import wraps
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Salvador de la Puente González
# Copyright (c) 2020 Salvador E. Tropea
# Copyright (c) 2020 Instituto Nacional de Tecnología Industrial
# License: MIT
# Project: MCPY https://github.com/delapuente/mcpy
from ast import NodeTransformer, AST, copy_location, fix_missing_locations, Call, Constant, Name, Expr, Load
from .unparse import unparse