From 3d995628ec8cfce38f3746643d343bb246d150e1 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Mon, 23 Jul 2012 06:04:01 -0700 Subject: 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 --- HISTORY.md | 1 - README.md | 9 ++++----- setup.py | 26 ++++++-------------------- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 34f5193..5516595 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 diff --git a/README.md b/README.md index f6340e1..efcefff 100644 --- a/README.md +++ b/README.md @@ -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)-- diff --git a/setup.py b/setup.py index 2c18af5..136e886 100644 --- a/setup.py +++ b/setup.py @@ -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, -- cgit v1.2.1