]> Pileus Git - ~andy/git/blobdiff - git_remote_helpers/setup.py
git_remote_helpers: use 2to3 if building with Python 3
[~andy/git] / git_remote_helpers / setup.py
index 4d434b65cbf5c42a455d5cd3bced030bfb51a245..6de41deb4435e76e349e67cc886bb92b8cb92e78 100644 (file)
@@ -4,6 +4,15 @@
 
 from distutils.core import setup
 
+# If building under Python3 we need to run 2to3 on the code, do this by
+# trying to import distutils' 2to3 builder, which is only available in
+# Python3.
+try:
+    from distutils.command.build_py import build_py_2to3 as build_py
+except ImportError:
+    # 2.x
+    from distutils.command.build_py import build_py
+
 setup(
     name = 'git_remote_helpers',
     version = '0.1.0',
@@ -14,4 +23,5 @@ setup(
     url = 'http://www.git-scm.com/',
     package_dir = {'git_remote_helpers': ''},
     packages = ['git_remote_helpers', 'git_remote_helpers.git'],
+    cmdclass = {'build_py': build_py},
 )