summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorAlex Stewart <alex@foogod.com>2010-08-31 11:22:14 -0700
committerAlex Stewart <alex@foogod.com>2010-08-31 11:22:14 -0700
commit101930a350ceea38242b292cc9f1a5db95ecde04 (patch)
treee4020da5684c750eaa966672f0bd6829d905aa5a /setup.py
parentbbe7ec73479aeac7e69623d7e4fa3d6fc92a8988 (diff)
downloadnose-101930a350ceea38242b292cc9f1a5db95ecde04.tar.gz
More Py3 fixups: created setup3lib, added pyversion_patching to build_tests
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py77
1 files changed, 7 insertions, 70 deletions
diff --git a/setup.py b/setup.py
index 35d177f..37df51f 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,8 @@ py_vers_tag = '-%s.%s' % sys.version_info[:2]
test_dirs = ['functional_tests', 'unit_tests', os.path.join('doc','doc_tests')]
try:
- from setuptools import setup, find_packages
+ from setup3lib import setup
+ from setuptools import find_packages
addl_args = dict(
zip_safe = False,
packages = find_packages(),
@@ -21,6 +22,11 @@ try:
],
},
test_suite = 'nose.collector',
+ use_2to3 = True,
+ test_dirs = test_dirs,
+ # The following is needed for the ispackage doctests to work right:
+ test_build_dir = "build/lib",
+ pyversion_patching = True,
)
# This is required by multiprocess plugin; on Windows, if
@@ -55,75 +61,6 @@ except ImportError:
scripts = ['bin/nosetests'],
)
-if sys.version_info >= (3,):
- from distutils.core import Command
- from distutils.util import Mixin2to3
- from distutils import dir_util, file_util, log
- #from distutils.command import build
- import setuptools.command.test
- from pkg_resources import normalize_path
-
- class BuildTestsCommand (Command, Mixin2to3):
- # Create mirror copy of tests, convert all .py files using 2to3
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- bcmd = self.get_finalized_command('build')
- self.build_base = bcmd.build_base
- self.test_base = os.path.join(self.build_base, 'tests')
-
- def run(self):
- #self.run_command('egg_info')
- build_base = self.build_base
- test_base = self.test_base
- bpy_cmd = self.get_finalized_command("build_py")
- lib_base = normalize_path(bpy_cmd.build_lib)
- modified = []
- py_modified = []
- for testdir in test_dirs:
- for srcdir, dirnames, filenames in os.walk(testdir):
- destdir = os.path.join(test_base, srcdir)
- dir_util.mkpath(destdir)
- for fn in filenames:
- if fn.startswith("."):
- continue # skip .svn folders and such
- dstfile, copied = file_util.copy_file(
- os.path.join(srcdir, fn),
- os.path.join(destdir, fn),
- update=True)
- if copied:
- modified.append(dstfile)
- if fn.endswith('.py'):
- py_modified.append(dstfile)
- self.run_2to3(py_modified)
-
- file_util.copy_file('setup.cfg', build_base, update=True)
- dir_util.mkpath(lib_base)
- self.reinitialize_command('egg_info', egg_base=lib_base)
- self.run_command('egg_info')
-
- class TestCommand (setuptools.command.test.test):
- # Override 'test' command to make sure 'build_tests' gets run first.
- def run(self):
- self.run_command('build_tests')
- setuptools.command.test.test.run(self)
-
- #class build_py3(build.build):
- # # Override 'build' command for Python 3 to trigger 'build_tests' too
- # def build_tests(self):
- # return sys.version_info >= (3,0)
- # sub_commands = build.build.sub_commands + [('build_tests', build_tests)]
-
- addl_args['use_2to3'] = True
- addl_args['cmdclass'] = dict(
- build_tests = BuildTestsCommand,
- test = TestCommand,
- #build = build_py3,
- )
-
setup(
name = 'nose',
version = VERSION,