summaryrefslogtreecommitdiff
path: root/git_remote_helpers/setup.py
diff options
context:
space:
mode:
authorLibravatar John Keeping <john@keeping.me.uk>2013-01-20 13:15:34 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-01-24 19:32:35 -0800
commit62c814b6b60f5b5605e34c9806d874fe1088d416 (patch)
tree8595f9eca97346c2cb0b012360a312f5cae52e23 /git_remote_helpers/setup.py
parentgit_remote_helpers: force rebuild if python version changes (diff)
downloadtgif-62c814b6b60f5b5605e34c9806d874fe1088d416.tar.xz
git_remote_helpers: use 2to3 if building with Python 3
Using the approach detailed in the Python documentation[1], run 2to3 on the code as part of the build if building with Python 3. The code itself requires no changes to convert cleanly. [1] http://docs.python.org/3.3/howto/pyporting.html#during-installation Signed-off-by: John Keeping <john@keeping.me.uk> Acked-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git_remote_helpers/setup.py')
-rw-r--r--git_remote_helpers/setup.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/git_remote_helpers/setup.py b/git_remote_helpers/setup.py
index 4d434b65cb..6de41deb44 100644
--- a/git_remote_helpers/setup.py
+++ b/git_remote_helpers/setup.py
@@ -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},
)