Merge pull request #1834 from RonnyPfannschmidt/setuptools-scm-take-2

second take at setuptools_scm
This commit is contained in:
Bruno Oliveira 2017-04-27 09:10:23 -03:00 committed by GitHub
commit cccb2cc92b
7 changed files with 50 additions and 41 deletions

3
.gitignore vendored
View File

@ -18,6 +18,9 @@ include/
*~
.hypothesis/
# autogenerated
_pytest/_version.py
# setuptools
.eggs/
doc/*/_build

View File

@ -3,27 +3,25 @@ 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).
#. Check and finalize ``CHANGELOG.rst``.
2. Check and finalize ``CHANGELOG.rst``.
3. Write ``doc/en/announce/release-VERSION.txt`` and include
#. 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
4. Regenerate the docs examples using tox::
#. Regenerate the docs examples using tox::
tox -e regen
5. At this point, open a PR named ``release-X`` so others can help find regressions or provide suggestions.
#. At this point, open a PR named ``release-X`` so others can help find regressions or provide suggestions.
6. Use devpi for uploading a release tarball to a staging area::
#. Use devpi for uploading a release tarball to a staging area::
devpi use https://devpi.net/USER/dev
devpi upload --formats sdist,bdist_wheel
7. Run from multiple machines::
#. Run from multiple machines::
devpi use https://devpi.net/USER/dev
devpi test pytest==VERSION
@ -31,27 +29,27 @@ Note: this assumes you have already registered on pypi.
Alternatively, you can use `devpi-cloud-tester <https://github.com/nicoddemus/devpi-cloud-tester>`_ to test
the package on AppVeyor and Travis (follow instructions on the ``README``).
8. Check that tests pass for relevant combinations with::
#. Check that tests pass for relevant combinations with::
devpi list pytest
or look at failures with "devpi list -f pytest".
9. Feeling confident? Publish to pypi::
#. Feeling confident? Publish to pypi::
devpi push pytest==VERSION pypi:NAME
where NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.
10. Tag the release::
#. Tag the release::
git tag VERSION <hash>
git push origin VERSION
Make sure ``<hash>`` is **exactly** the git hash at the time the package was created.
11. Send release announcement to mailing lists:
#. Send release announcement to mailing lists:
- pytest-dev@python.org
- python-announce-list@python.org
@ -59,7 +57,7 @@ Note: this assumes you have already registered on pypi.
And announce the release on Twitter, making sure to add the hashtag ``#pytest``.
12. **After the release**
#. **After the release**
a. **patch release (2.8.3)**:
@ -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**

View File

@ -1,2 +1,8 @@
#
__version__ = '3.1.0.dev0'
__all__ = ['__version__']
try:
from ._version import version as __version__
except ImportError:
# broken installation, we don't even try
# unknown only works because we do poor mans version compare
__version__ = 'unknown'

View File

@ -18,4 +18,3 @@ if os.path.isdir('.git'):
else:
print('No .git directory found, skipping checking the manifest file')
sys.exit(0)

View File

@ -9,6 +9,10 @@ upload-dir = doc/en/build/html
[bdist_wheel]
universal = 1
[check-manifest]
ignore =
_pytest/_version.py
[metadata]
license_file = LICENSE

View File

@ -1,32 +1,27 @@
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()
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 +58,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 +71,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'],

View File

@ -47,6 +47,9 @@ commands=
[testenv:linting]
basepython = python2.7
# needed to keep check-manifest working
setenv =
SETUPTOOLS_SCM_PRETEND_VERSION=2.0.1
deps =
flake8
# pygments required by rst-lint
@ -56,7 +59,7 @@ deps =
commands =
{envpython} scripts/check-manifest.py
flake8 pytest.py _pytest testing
rst-lint CHANGELOG.rst HOWTORELEASE.rst README.rst
rst-lint CHANGELOG.rst HOWTORELEASE.rst README.rst --encoding utf-8
[testenv:py27-xdist]
deps=pytest-xdist>=1.13