aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools
diff options
context:
space:
mode:
authorLennart Regebro <regebro@gmail.com>2009-09-18 17:22:17 +0200
committerLennart Regebro <regebro@gmail.com>2009-09-18 17:22:17 +0200
commit3736fee0faddbbc93fa6b7a1b233d4c2dcf11d76 (patch)
tree9ecddc897e3039be6be67c6c5b75e126575f369f /setuptools
parent55413ad562eddc5ffc235bde5471fdf010421f9a (diff)
downloadexternal_python_setuptools-3736fee0faddbbc93fa6b7a1b233d4c2dcf11d76.tar.gz
external_python_setuptools-3736fee0faddbbc93fa6b7a1b233d4c2dcf11d76.tar.bz2
external_python_setuptools-3736fee0faddbbc93fa6b7a1b233d4c2dcf11d76.zip
Works with zope.interface now.
--HG-- branch : distribute extra : rebase_source : c8cd9fd837bbac96c8949f0015d84051bd8ab5c7
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/__init__.py2
-rw-r--r--setuptools/command/build_py.py6
-rw-r--r--setuptools/command/test.py28
3 files changed, 28 insertions, 8 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index 8c3eeb6d..ac5e6e5e 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -27,7 +27,7 @@ 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
+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
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index 2413b420..94f66741 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -21,7 +21,9 @@ try:
class Mixin2to3(_Mixin2to3):
def run_2to3(self, files, doctests = False):
- if not setuptools.run_2to3:
+ # 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:
return
if not files:
return
@@ -30,6 +32,8 @@ try:
self.fixer_names = []
for p in setuptools.lib2to3_fixer_packages:
self.fixer_names.extend(get_fixers_from_package(p))
+ for p in self.distribution.additional_2to3_fixers:
+ self.fixer_names.extend(get_fixers_from_package(p))
if doctests:
if setuptools.run_2to3_on_doctests:
r = DistutilsRefactoringTool(self.fixer_names)
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index db918dae..0f96e83a 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -1,4 +1,4 @@
-from setuptools import Command
+from setuptools import Command, run_2to3
from distutils.errors import DistutilsOptionError
import sys
from pkg_resources import *
@@ -81,12 +81,28 @@ class test(Command):
def with_project_on_sys_path(self, func):
- # Ensure metadata is up-to-date
- self.run_command('egg_info')
+ if getattr(self.distribution, 'run_2to3', run_2to3):
+ # If we run 2to3 we can not do this inplace:
- # Build extensions in-place
- self.reinitialize_command('build_ext', inplace=1)
- self.run_command('build_ext')
+ # Ensure metadata is up-to-date
+ self.reinitialize_command('build_py', inplace=0)
+ self.run_command('build_py')
+ bpy_cmd = self.get_finalized_command("build_py")
+ build_path = normalize_path(bpy_cmd.build_lib)
+
+ # Build extensions
+ self.reinitialize_command('egg_info', egg_base=build_path)
+ self.run_command('egg_info')
+
+ self.reinitialize_command('build_ext', inplace=0)
+ self.run_command('build_ext')
+ else:
+ # Without 2to3 inplace works fine:
+ self.run_command('egg_info')
+
+ # Build extensions in-place
+ self.reinitialize_command('build_ext', inplace=1)
+ self.run_command('build_ext')
ei_cmd = self.get_finalized_command("egg_info")