Commit 7596dc0c authored by Lennart Regebro's avatar Lennart Regebro

Name changes of the parameters.

--HG--
branch : distribute
extra : rebase_source : fc921b526cda13b02a4bb0215f91ee04d03dca57
parent bec82b20
......@@ -31,19 +31,19 @@ depends.txt = setuptools.command.egg_info:warn_depends_obsolete
[console_scripts]
easy_install = setuptools.command.easy_install:main
easy_install-2.6 = setuptools.command.easy_install:main
easy_install-3.1 = setuptools.command.easy_install:main
[setuptools.file_finders]
svn_cvs = setuptools.command.sdist:_default_revctrl
[distutils.setup_keywords]
additional_2to3_fixers = setuptools.dist:assert_string_list
dependency_links = setuptools.dist:assert_string_list
entry_points = setuptools.dist:check_entry_points
extras_require = setuptools.dist:check_extras
run_2to3 = setuptools.dist:assert_bool
package_data = setuptools.dist:check_package_data
install_requires = setuptools.dist:check_requirements
use_2to3 = setuptools.dist:assert_bool
use_2to3_fixers = setuptools.dist:assert_string_list
include_package_data = setuptools.dist:assert_bool
exclude_package_data = setuptools.dist:check_package_data
namespace_packages = setuptools.dist:check_nsp
......@@ -51,7 +51,7 @@ test_suite = setuptools.dist:check_test_suite
eager_resources = setuptools.dist:assert_string_list
zip_safe = setuptools.dist:assert_bool
test_loader = setuptools.dist:check_importable
convert_doctests_2to3 = setuptools.dist:assert_string_list
convert_2to3_doctests = setuptools.dist:assert_string_list
tests_require = setuptools.dist:check_requirements
[setuptools.installation]
......
......@@ -6,7 +6,7 @@ Starting with version 0.6.2, Distribute supports Python 3. Installing and
using distribute for Python 3 code works exactly the same as for Python 2
code, but Distribute also helps you to support Python 2 and Python 3 from
the same source code by letting you run 2to3 on the code as a part of the
build process. by setting the keyword parameter ``run_2to3`` to True.
build process. by setting the keyword parameter ``use_2to3`` to True.
Distrubute as help during porting
......@@ -18,7 +18,7 @@ setup.py so that you can run the unit tests with ``python setup.py test``.
See :ref:`test` for more information on this.
Once you have the tests running under Python 2, you can add the run_2to3
Once you have the tests running under Python 2, you can add the use_2to3
keyword parameters to setup(), and start running the tests under Python 3.
The test command will now first run the build command during which the code
will be converted with 2to3, and the tests will then be run from the build
......@@ -27,11 +27,11 @@ directory, as opposed from the source directory as is normally done.
Distribute will convert all Python files, and also all doctests in Python
files. However, if you have doctests located in separate text files, these
will not automatically be converted. By adding them to the
``convert_doctests_2to3`` keyword parameter Distrubute will convert them as
``convert_2to3_doctests`` keyword parameter Distrubute will convert them as
well.
By default, the conversion uses all fixers in the ``lib2to3.fixers`` package.
To use additional fixes, the parameter ``additional_2to3_fixers`` can be set
To use additional fixes, the parameter ``use_2to3_fixers`` can be set
to a list of names of packages containing fixers.
A typical setup.py can look something like this::
......@@ -46,9 +46,9 @@ A typical setup.py can look something like this::
package_dir = {'': 'src'},
packages = ['your', 'you.module'],
test_suite = 'your.module.tests',
run_2to3 = True,
convert_doctests_2to3 = ['src/your/module/README.txt'],
additional_2to3_fixers = ['your.fixers']
use_2to3 = True,
convert_2to3_doctests = ['src/your/module/README.txt'],
use_2to3_fixers = ['your.fixers']
)
Differential conversion
......@@ -59,7 +59,7 @@ if the source file has been changed. If you add a file to the doctests
that should be converted, it will not be converted the next time you run
the tests, since it hasn't been modified. You need to remove it from the
build directory. Also if you run the build, install or test commands before
adding the run_2to3 parameter, you will have to remove the build directory
adding the use_2to3 parameter, you will have to remove the build directory
before you run the test command, as the files otherwise will seem updated,
and no conversion will happen.
......@@ -84,7 +84,7 @@ list ``setuptools.commands.build_py.build_py.fixers``, which then contains the
list of all fixer class names.
If you don't want to run the 2to3 conversion on the doctests in Python files,
you can turn that off by setting ``setuptools.run_2to3_on_doctests = False``.
you can turn that off by setting ``setuptools.use_2to3_on_doctests = False``.
Note on compatibility with setuptools
=====================================
......@@ -101,9 +101,9 @@ dict and pass that dict into setup()::
extra = {}
if sys.version_info >= (3,):
extra['run_2to3'] = True
extra['convert_doctests_2to3'] = ['src/your/module/README.txt']
extra['additional_2to3_fixers'] = ['your.fixers']
extra['use_2to3'] = True
extra['convert_2to3_doctests'] = ['src/your/module/README.txt']
extra['use_2to3_fixers'] = ['your.fixers']
setup(name='your.module',
version = '1.0',
......
......@@ -404,16 +404,16 @@ unless you need the associated ``setuptools`` feature.
mess with it. For more details on how this argument works, see the section
below on `Automatic Resource Extraction`_.
``run_2to3``
``use_2to3``
Convert the source code from Python 2 to Python 3 with 2to3 during the
build process. See :doc:`python3` for more details.
``convert_doctests_2to3``
``convert_2to3_doctests``
List of doctest source files that need to be converted with 2to3.
See :doc:`python3` for more details.
``additional_2to3_fixers``
A list of modules to serach for additional fixers to be used during
``use_2to3_fixers``
A list of modules to search for additional fixers to be used during
the 2to3 conversion. See :doc:`python3` for more details.
......
......@@ -97,9 +97,9 @@ dist = setup(
"include_package_data = setuptools.dist:assert_bool",
"dependency_links = setuptools.dist:assert_string_list",
"test_loader = setuptools.dist:check_importable",
"run_2to3 = setuptools.dist:assert_bool",
"convert_doctests_2to3 = setuptools.dist:assert_string_list",
"additional_2to3_fixers = setuptools.dist:assert_string_list",
"use_2to3 = setuptools.dist:assert_bool",
"convert_2to3_doctests = setuptools.dist:assert_string_list",
"use_2to3_fixers = setuptools.dist:assert_string_list",
],
"egg_info.writers": [
......
......@@ -24,14 +24,10 @@ _distribute = True
bootstrap_install_from = None
# Should we run 2to3 on all Python files, in Python 3.x?
# Default: no; assume that a distribution installed for 3.x is already
# written in 3.x
run_2to3 = False # Default value if run_2to3 argument not given.
# If we run 2to3 on .py files, should we also convert docstrings?
# Default: yes; assume that we can detect doctests reliably
run_2to3_on_doctests = True
# Package names for fixer packages
# Standard package names for fixer packages
lib2to3_fixer_packages = ['lib2to3.fixes']
def find_packages(where='.', exclude=()):
......
......@@ -23,7 +23,7 @@ try:
def run_2to3(self, files, doctests = False):
# See of the distribution option has been set, otherwise check the
# setuptools default.
if self.distribution.run_2to3 is not True and setuptools.run_2to3 is False:
if self.distribution.use_2to3 is not True:
return
if not files:
return
......@@ -32,8 +32,8 @@ try:
self.fixer_names = []
for p in setuptools.lib2to3_fixer_packages:
self.fixer_names.extend(get_fixers_from_package(p))
if self.distribution.additional_2to3_fixers is not None:
for p in self.distribution.additional_2to3_fixers:
if self.distribution.use_2to3_fixers is not None:
for p in self.distribution.use_2to3_fixers:
self.fixer_names.extend(get_fixers_from_package(p))
if doctests:
if setuptools.run_2to3_on_doctests:
......@@ -137,7 +137,7 @@ class build_py(_build_py, Mixin2to3):
srcfile = os.path.join(src_dir, filename)
outf, copied = self.copy_file(srcfile, target)
srcfile = os.path.abspath(srcfile)
if copied and srcfile in self.distribution.convert_doctests_2to3:
if copied and srcfile in self.distribution.convert_2to3_doctests:
self.__doctests_2to3.append(outf)
......
from setuptools import Command, run_2to3
from setuptools import Command
from distutils.errors import DistutilsOptionError
import sys
from pkg_resources import *
......@@ -81,7 +81,7 @@ class test(Command):
def with_project_on_sys_path(self, func):
if getattr(self.distribution, 'run_2to3', run_2to3):
if getattr(self.distribution, 'use_2to3', False):
# If we run 2to3 we can not do this inplace:
# Ensure metadata is up-to-date
......
......@@ -255,11 +255,11 @@ class Distribution(_Distribution):
if value is not None:
ep.require(installer=self.fetch_build_egg)
ep.load()(self, ep.name, value)
if getattr(self, 'convert_doctests_2to3', None):
if getattr(self, 'convert_2to3_doctests', None):
# XXX may convert to set here when we can rely on set being builtin
self.convert_doctests_2to3 = [os.path.abspath(p) for p in self.convert_doctests_2to3]
self.convert_2to3_doctests = [os.path.abspath(p) for p in self.convert_2to3_doctests]
else:
self.convert_doctests_2to3 = []
self.convert_2to3_doctests = []
def fetch_build_egg(self, req):
"""Fetch an egg needed for building"""
......
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