Commit 3d995628 by Chris Jerdonek

Remove the --force2to3 option from setup.py.

See this link for the underlying reason:

  https://bitbucket.org/tarek/distribute/issue/292/allow-use_2to3-with-python-2
parent 88516160
......@@ -9,7 +9,6 @@ History
- Added a `parse()` function that yields a printable, pre-compiled
parse tree.
- Added support for rendering pre-compiled templates.
- Added --force2to3 option to setup.py (issue \#121).
- Added support for [PyPy](http://pypy.org/) (issue \#125).
- Added support for [Travis CI](http://travis-ci.org) (issue \#124). [msabramo]
- Bugfix: exceptions raised from a property are no longer swallowed
......
......@@ -222,11 +222,10 @@ To convert the code to Python 3 manually (while using Python 3)--
python setup.py build
And while using Python 2--
python setup.py --force2to3 build
Both of the above write the converted code to a subdirectory called `build`.
This writes the converted code to a subdirectory called `build`.
By design, Python 3 builds
[cannot](https://bitbucket.org/tarek/distribute/issue/292/allow-use_2to3-with-python-2)
be created from Python 2.
To convert the code without using setup.py, you can use
[2to3](http://docs.python.org/library/2to3.html) as follows (two steps)--
......
......@@ -73,8 +73,6 @@ import shutil
import sys
OPTION_FORCE_2TO3 = '--force2to3'
py_version = sys.version_info
# distutils does not seem to support the following setup() arguments.
......@@ -280,19 +278,6 @@ PACKAGES = [
]
def parse_args(sys_argv):
"""
Modify sys_argv in place and return whether to force use of 2to3.
"""
should_force2to3 = False
if len(sys_argv) > 1 and sys_argv[1] == OPTION_FORCE_2TO3:
sys_argv.pop(1)
should_force2to3 = True
return should_force2to3
# The purpose of this function is to follow the guidance suggested here:
#
# http://packages.python.org/distribute/python3.html#note-on-compatibility-with-setuptools
......@@ -300,13 +285,16 @@ def parse_args(sys_argv):
# The guidance is for better compatibility when using setuptools (e.g. with
# earlier versions of Python 2) instead of Distribute, because of new
# keyword arguments to setup() that setuptools may not recognize.
def get_extra_args(should_force2to3):
def get_extra_args():
"""
Return a dictionary of extra args to pass to setup().
"""
extra = {}
if py_version >= (3, ) or should_force2to3:
# TODO: it might be more correct to check whether we are using
# Distribute instead of setuptools, since use_2to3 doesn't take
# effect when using Python 2, even when using Distribute.
if py_version >= (3, ):
# Causes 2to3 to be run during the build step.
extra['use_2to3'] = True
......@@ -319,8 +307,6 @@ def main(sys_argv):
# TODO: include the following in a verbose mode.
print("pystache: using: version %s of %s" % (repr(dist.__version__), repr(dist)))
should_force2to3 = parse_args(sys_argv)
command = sys_argv[-1]
if command == 'publish':
......@@ -332,7 +318,7 @@ def main(sys_argv):
long_description = read(DESCRIPTION_PATH)
template_files = ['*.mustache', '*.txt']
extra_args = get_extra_args(should_force2to3)
extra_args = get_extra_args()
setup(name='pystache',
version=VERSION,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment