Skip to content

Commit

Permalink
git_remote_helpers: use 2to3 if building with Python 3
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John Keeping authored and Junio C Hamano committed Jan 25, 2013
1 parent fadf8c7 commit 62c814b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions git_remote_helpers/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -14,4 +23,5 @@
url = 'http://www.git-scm.com/',
package_dir = {'git_remote_helpers': ''},
packages = ['git_remote_helpers', 'git_remote_helpers.git'],
cmdclass = {'build_py': build_py},
)

0 comments on commit 62c814b

Please sign in to comment.