diff --git a/.gitignore b/.gitignore index 0e42b11ff..3b7ec9fac 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,9 @@ include/ *~ .hypothesis/ +# autogenerated +_pytest/_version.py +# setuptools .eggs/ doc/*/_build diff --git a/HOWTORELEASE.rst b/HOWTORELEASE.rst index 372ecf7f1..523ed41cc 100644 --- a/HOWTORELEASE.rst +++ b/HOWTORELEASE.rst @@ -3,11 +3,9 @@ How to release pytest Note: this assumes you have already registered on pypi. -1. Bump version numbers in ``_pytest/__init__.py`` (``setup.py`` reads it). +1. Check and finalize ``CHANGELOG.rst``. -2. Check and finalize ``CHANGELOG.rst``. - -3. Write ``doc/en/announce/release-VERSION.txt`` and include +2. Write ``doc/en/announce/release-VERSION.txt`` and include it in ``doc/en/announce/index.txt``. Run this command to list names of authors involved:: git log $(git describe --abbrev=0 --tags)..HEAD --format='%aN' | sort -u @@ -81,5 +79,3 @@ Note: this assumes you have already registered on pypi. 9. Push ``master`` and ``features``. c. **major release (3.0.0)**: same steps as that of a **minor release** - - diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 0a37f23b2..a6f201091 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,5 @@ -# -__version__ = '3.1.0.dev0' +__all__ = ['__version__'] +try: + from ._version import version as __version__ +except ImportError: + __version__ = None # broken installation, we don't even try diff --git a/setup.py b/setup.py index 1d0630cd2..3cba379e4 100644 --- a/setup.py +++ b/setup.py @@ -18,15 +18,6 @@ classifiers = ['Development Status :: 6 - Mature', with open('README.rst') as fd: long_description = fd.read() -def get_version(): - p = os.path.join(os.path.dirname( - os.path.abspath(__file__)), "_pytest", "__init__.py") - with open(p) as f: - for line in f.readlines(): - if "__version__" in line: - return line.strip().split("=")[-1].strip(" '") - raise ValueError("could not read version") - def has_environment_marker_support(): """ @@ -63,7 +54,9 @@ def main(): name='pytest', description='pytest: simple powerful testing with Python', long_description=long_description, - version=get_version(), + use_scm_version={ + 'write_to': '_pytest/_version.py', + }, url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], @@ -74,6 +67,7 @@ def main(): keywords="test unittest", cmdclass={'test': PyTest}, # the following should be enabled for release + setup_requires=['setuptools-scm'], install_requires=install_requires, extras_require=extras_require, packages=['_pytest', '_pytest.assertion', '_pytest._code', '_pytest.vendored_packages'],