From 9874d8048db7c49ab37e253e58040ba8fbe6bfcb Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Sun, 13 Jan 2013 17:00:17 -0600 Subject: [PATCH] Run 2to3 for python 3 install --- setup.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setup.py b/setup.py index 94c9f95..eeaf162 100644 --- a/setup.py +++ b/setup.py @@ -118,6 +118,21 @@ kwds = dict(ext_modules = [Extension( extra_objects = objs_core, extra_link_args = extra_link_args)]) +def run_2to3(): + import lib2to3.refactor + from distutils.command.build_py import build_py_2to3 as build_py + print("Installing 2to3 fixers") + # need to convert sources to Py3 on installation + fixes = lib2to3.refactor.get_fixers_from_package("lib2to3.fixes") + #fixes = [fix for fix in fixes + # if fix.split('fix_')[-1] not in ('next',) + #] + + kwds["cmdclass"] = {"build_py": build_py} + +if sys.version_info[0] >= 3: + run_2to3() + # Read version from llvm/__init__.py pat = re.compile(r'__version__\s*=\s*(\S+)', re.M) data = open('llvm/__init__.py').read()