Add python3-nose
[platform/upstream/python-nose.git] / setup.py
1 import sys
2 import os
3
4 VERSION = '1.2.1'
5 py_vers_tag = '-%s.%s' % sys.version_info[:2]
6
7 test_dirs = ['functional_tests', 'unit_tests', os.path.join('doc','doc_tests'), 'nose']
8
9 if sys.version_info >= (3,):
10     try:
11         import setuptools
12     except ImportError:
13         from distribute_setup import use_setuptools
14         use_setuptools()
15
16     extra = {'use_2to3': True,
17              'test_dirs': test_dirs,
18              'test_build_dir': 'build/tests',
19              'pyversion_patching': True,
20              }
21 else:
22     extra = {}
23
24 try:
25     from setup3lib import setup
26     from setuptools import find_packages
27     addl_args = dict(
28         zip_safe = False,
29         packages = find_packages(),
30         entry_points = {
31         'console_scripts': [
32             'nosetests = nose:run_exit',
33             'nosetests%s = nose:run_exit' % py_vers_tag,
34             ],
35         'distutils.commands': [
36             ' nosetests = nose.commands:nosetests',
37             ],
38         },
39         test_suite = 'nose.collector',
40         )
41     addl_args.update(extra)
42
43     # This is required by multiprocess plugin; on Windows, if
44     # the launch script is not import-safe, spawned processes
45     # will re-run it, resulting in an infinite loop.
46     if sys.platform == 'win32':
47         import re
48         from setuptools.command.easy_install import easy_install
49
50         def wrap_write_script(self, script_name, contents, *arg, **kwarg):
51             bad_text = re.compile(
52                 "\n"
53                 "sys.exit\(\n"
54                 "   load_entry_point\(([^\)]+)\)\(\)\n"
55                 "\)\n")
56             good_text = (
57                 "\n"
58                 "if __name__ == '__main__':\n"
59                 "    sys.exit(\n"
60                 r"        load_entry_point(\1)()\n"
61                 "    )\n"
62                 )
63             contents = bad_text.sub(good_text, contents)
64             return self._write_script(script_name, contents, *arg, **kwarg)
65         easy_install._write_script = easy_install.write_script
66         easy_install.write_script = wrap_write_script
67
68 except ImportError:
69     from distutils.core import setup
70     addl_args = dict(
71         packages = ['nose', 'nose.ext', 'nose.plugins', 'nose.sphinx'],
72         scripts = ['bin/nosetests'],
73         )
74
75 setup(
76     name = 'nose',
77     version = VERSION,
78     author = 'Jason Pellerin',
79     author_email = 'jpellerin+nose@gmail.com',
80     description = ('nose extends unittest to make testing easier'),
81     long_description = \
82     """nose extends the test loading and running features of unittest, making
83     it easier to write, find and run tests.
84
85     By default, nose will run tests in files or directories under the current
86     working directory whose names include "test" or "Test" at a word boundary
87     (like "test_this" or "functional_test" or "TestClass" but not
88     "libtest"). Test output is similar to that of unittest, but also includes
89     captured stdout output from failing tests, for easy print-style debugging.
90
91     These features, and many more, are customizable through the use of
92     plugins. Plugins included with nose provide support for doctest, code
93     coverage and profiling, flexible attribute-based test selection,
94     output capture and more. More information about writing plugins may be
95     found on in the nose API documentation, here:
96     http://readthedocs.org/docs/nose/
97
98     If you have recently reported a bug marked as fixed, or have a craving for
99     the very latest, you may want the development version instead:
100     https://github.com/nose-devs/nose/tarball/master#egg=nose-dev
101     """,
102     license = 'GNU LGPL',
103     keywords = 'test unittest doctest automatic discovery',
104     url = 'http://readthedocs.org/docs/nose/',
105     data_files = [('man/man1', ['nosetests.1'])],
106     package_data = {'': ['*.txt',
107                          'examples/*.py',
108                          'examples/*/*.py']},
109     classifiers = [
110         'Development Status :: 5 - Production/Stable',
111         'Intended Audience :: Developers',
112         'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
113         'Natural Language :: English',
114         'Operating System :: OS Independent',
115         'Programming Language :: Python',
116         'Programming Language :: Python :: 3',
117         'Topic :: Software Development :: Testing'
118         ],
119     **addl_args
120     )
121