Skip to content

Commit

Permalink
[DEV_TOOLS, GIT, PACKAGING] Modify all components based on the rename...
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Jan 4, 2015
1 parent 2a52991 commit e603820
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 657 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
*.py text diff=python
*.in text
*.ast text
*.tree text

# Documents
*.doc diff=astextplain
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ venv
*.sublime*

# Auto-generated, include according to files in the directory.
py2c/ast/python.py
py2c/tree/python.py

#-----------------------------------------------------------
# Beyond this is Github's .gitignore for Python projects.
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include README.md
include py2c/ast/*.ast
include py2c/tree/*.tree
12 changes: 6 additions & 6 deletions dev_tools/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ Testing:
Allow for each test to be describe uniquely shown in a good-looking way,
to make writing tests feel worthwhile.

AST and AST Generator:
Tree and Node Generator:
✔ Implement. @done (12-December-2014 05:03PM)
- Remove dependency on ply of ast_gen.py (for parsing files). @contrib @moderate
This is really a might-do as since ast_gen.py has been moved into the
- Remove dependency on ply of node_gen.py (for parsing files). @contrib @moderate
This is really a might-do as since node_gen.py has been moved into the
package, this dependency is not a problem in any way.
✔ Allow inheritence of fields in AST definitions. @done (04-January-2015 10:57AM)
✔ Allow inheritence of fields in Node definitions. @done (04-January-2015 10:57AM)
- Make RecursiveASTVisitor tests more comprehensive. @contrib @easy
- Move to a "flow" tree for simplifying analysis.

Managers:
✔ Implement BaseManager @done (12-December-2014 05:03PM)
Expand All @@ -54,7 +53,8 @@ Configuration:
- Integrate into all components.

Pre-processing:
✔ Implement. @done (12-December-2014 05:03PM)
✘ Implement a code to custom Python AST Tree converter. @cancelled (04-January-2015 11:54AM)
- Move to a "flow" tree for simplifying analysis.
- Change tests to only check the specific changes. @contrib @easy
The tests should not check every single combination, just a unique bunch of
them, to cover the cases where we make changes.
Expand Down
2 changes: 1 addition & 1 deletion dev_tools/check_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def basic_installation_checks():
run_and_report(
"Check: Is auto-generated file usable? ",
"No!", "Yes!",
sys.executable + " -c 'import py2c.ast.python'", False
sys.executable + " -c 'import py2c.tree.python'", False
)


Expand Down
4 changes: 2 additions & 2 deletions dev_tools/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def should_remove_file(root, name):
matches_any_pattern(name, FILE_PATTERNS) or
(
REMOVE_GENERATED_AST and
root.endswith(os.path.join("py2c", "ast")) and
root.endswith(os.path.join("py2c", "tree")) and
name.endswith(".py") and
name not in ["__init__.py", "ast_gen.py"]
name not in ["__init__.py", "node_gen.py"]
)
)

Expand Down
15 changes: 7 additions & 8 deletions dev_tools/tree_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
#------------------------------------------------------------------------------

import ast
import py2c.ast

import py2c.ast.python as py
from py2c.tree import Node, iter_fields as py_iter_fields
import py2c.tree.python as py_tree


class Indentor(object):
Expand Down Expand Up @@ -45,7 +44,7 @@ def write(*args, sep="", end=""):
def _dump(node, indentor):
if isinstance(node, (list, tuple)):
_dump_list(node, indentor)
elif isinstance(node, (py2c.ast.AST, ast.AST)):
elif isinstance(node, (Node, ast.AST)):
_dump_node(node, indentor)
else:
write(indentor, repr(node))
Expand Down Expand Up @@ -73,16 +72,16 @@ def _dump_list(li, indentor):

def _dump_node(node, indentor):
# Initial header
if isinstance(node, py2c.ast.AST):
module = "py"
iter_fields = py2c.ast.iter_fields
if isinstance(node, Node):
module = "py_tree"
iter_fields = py_iter_fields
else:
module = "ast"
iter_fields = ast.iter_fields
write(indentor, "{}.{}(".format(module, node.__class__.__name__))

# Should the node be printed inline
in_line = isinstance(node, (py.Name, py.NameConstant, ast.Name, ast.NameConstant))
in_line = isinstance(node, (py_tree.Name, py_tree.NameConstant, ast.Name, ast.NameConstant))
length = len(node._fields)
for i, (name, value) in enumerate(iter_fields(node)):
with indentor:
Expand Down
Loading

0 comments on commit e603820

Please sign in to comment.