Commit 4cb1368a authored by Stefan Behnel's avatar Stefan Behnel

move JediTyper into Tools directory as it's not in a state that would suggest...

move JediTyper into Tools directory as it's not in a state that would suggest making it a part of Cython

--HG--
rename : Cython/Compiler/Tests/TestJediTyper.py => Cython/Tests/TestJediTyper.py
rename : Cython/Compiler/JediTyper.py => Tools/jedi-typer.py
parent 1133c6d5
......@@ -3,14 +3,18 @@
from __future__ import absolute_import
import unittest
import sys
import os.path
from textwrap import dedent
from contextlib import contextmanager
from tempfile import NamedTemporaryFile
from ..ParseTreeTransforms import NormalizeTree, InterpretCompilerDirectives
from .. import Main, Symtab, Visitor
from ...TestUtils import TransformTest
from Cython.Compiler.ParseTreeTransforms import NormalizeTree, InterpretCompilerDirectives
from Cython.Compiler import Main, Symtab, Visitor
from Cython.TestUtils import TransformTest
TOOLS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'Tools'))
@contextmanager
......@@ -26,12 +30,16 @@ def _tempfile(code):
def _test_typing(code, inject=False):
from ..JediTyper import analyse, inject_types
sys.path.insert(0, TOOLS_DIR)
try:
module = __import__('jedi-typer')
finally:
sys.path.remove(TOOLS_DIR)
lines = []
with _tempfile(code) as f:
types = analyse(f.name)
types = module.analyse(f.name)
if inject:
lines = inject_types(f.name, types)
lines = module.inject_types(f.name, types)
return types, lines
......
"""
Inject Cython type declarations into a .py file using the Jedi static analysis tool.
"""
from __future__ import absolute_import
......
......@@ -1594,6 +1594,7 @@ def refactor_for_py3(distdir, cy3_dir):
recursive-include Cython/Debugger/Tests *
recursive-include Cython/Utility *
recursive-exclude pyximport test
include Tools/*.py
include pyximport/*.py
include runtests.py
include cython.py
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment