PageRenderTime 28ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/setup.py

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