diff --git a/_pytest/__init__.py b/_pytest/__init__.py index df4c53b02..7c69a96f5 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,10 +1,8 @@ -import pkg_resources - __all__ = ['__version__'] try: - __version__ = pkg_resources.get_distribution('pytest').version -except Exception: + from ._version import __version__ +except ImportError: # broken installation, we don't even try # unknown only works because we do poor mans version compare __version__ = 'unknown' diff --git a/setup.cfg b/setup.cfg index f3299af5b..816539e2e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,6 +9,10 @@ upload-dir = doc/en/build/html [bdist_wheel] universal = 1 +[check-manifest] +ignore = + _pytest/_version.py + [metadata] license_file = LICENSE diff --git a/setup.py b/setup.py index 73d42b73d..a71692c25 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,23 @@ -import os, sys +import os +import sys import setuptools import pkg_resources from setuptools import setup, Command -classifiers = ['Development Status :: 6 - Mature', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: POSIX', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: MacOS :: MacOS X', - 'Topic :: Software Development :: Testing', - 'Topic :: Software Development :: Libraries', - 'Topic :: Utilities'] + [ - ('Programming Language :: Python :: %s' % x) for x in - '2 2.6 2.7 3 3.3 3.4 3.5 3.6'.split()] +classifiers = [ + 'Development Status :: 6 - Mature', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: MacOS :: MacOS X', + 'Topic :: Software Development :: Testing', + 'Topic :: Software Development :: Libraries', + 'Topic :: Utilities', +] + [ + ('Programming Language :: Python :: %s' % x) + for x in '2 2.6 2.7 3 3.3 3.4 3.5 3.6'.split() +] with open('README.rst') as fd: long_description = fd.read() @@ -54,7 +58,9 @@ def main(): name='pytest', description='pytest: simple powerful testing with Python', long_description=long_description, - use_scm_version=True, + use_scm_version={ + 'write_to': '_pytest/_version.py', + }, url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],