equal
deleted
inserted
replaced
8 # GNU General Public License version 2 or any later version. |
8 # GNU General Public License version 2 or any later version. |
9 |
9 |
10 from __future__ import absolute_import, print_function |
10 from __future__ import absolute_import, print_function |
11 |
11 |
12 import ast |
12 import ast |
|
13 import importlib |
13 import os |
14 import os |
14 import sys |
15 import sys |
15 import traceback |
16 import traceback |
16 |
17 |
17 # Modules that have both Python and C implementations. |
18 # Modules that have both Python and C implementations. |
48 if haveprint and 'print_function' not in futures: |
49 if haveprint and 'print_function' not in futures: |
49 print('%s requires print_function' % f) |
50 print('%s requires print_function' % f) |
50 |
51 |
51 def check_compat_py3(f): |
52 def check_compat_py3(f): |
52 """Check Python 3 compatibility of a file with Python 3.""" |
53 """Check Python 3 compatibility of a file with Python 3.""" |
53 import importlib # not available on Python 2.6 |
|
54 with open(f, 'rb') as fh: |
54 with open(f, 'rb') as fh: |
55 content = fh.read() |
55 content = fh.read() |
56 |
56 |
57 try: |
57 try: |
58 ast.parse(content) |
58 ast.parse(content) |