From b55d66d0cf571ec10cbedd84b9ae5f44e6680961 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 2 Apr 2015 10:38:25 +0200 Subject: [PATCH] - avoid setting of versions and targets in conf.py and Makefile as discussed on pytest-dev - "make help" now prints pytest specific information. - add a "_getdoctarget.py" helper - make ``setup.py`` read the version from ``_pytest/__init__.py`` --HG-- branch : release-checklist --- CHANGELOG | 3 +++ _pytest/__init__.py | 2 +- doc/en/Makefile | 33 +++++++++++++-------------------- doc/en/_getdoctarget.py | 16 ++++++++++++++++ doc/en/conf.py | 11 +++++++---- doc/en/release.txt | 27 ++++++++++++--------------- setup.py | 11 ++++++++++- 7 files changed, 62 insertions(+), 41 deletions(-) create mode 100755 doc/en/_getdoctarget.py diff --git a/CHANGELOG b/CHANGELOG index f68ef49b2..464531ad9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ 2.7.1.dev (compared to 2.7.0) ----------------------------- +- streamlined and documented release process. Also all versions + (in setup.py and documentation generation) are now read + from _pytest/__init__.py. 2.7.0 (compared to 2.6.4) ----------------------------- diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 293991c32..9db3f25e1 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.7.1.dev' +__version__ = '2.7.1.dev1' diff --git a/doc/en/Makefile b/doc/en/Makefile index abffd92bb..ce62f0ce6 100644 --- a/doc/en/Makefile +++ b/doc/en/Makefile @@ -15,46 +15,39 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest -regen: - PYTHONDONTWRITEBYTECODE=1 COLUMNS=76 regendoc --update *.txt */*.txt help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " changes to make an overview of all changed/added/deprecated items" + @echo " showtarget to show the pytest.org target directory" + @echo " install to install docs to pytest.org/SITETARGET" + @echo " install-ldf to install the doc pdf to pytest.org/SITETARGET" + @echo " regen to regenerate pytest examples using the installed pytest" @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* -SITETARGET=dev +SITETARGET=$(shell ./_getdoctarget.py) + +showtarget: + @echo $(SITETARGET) install: html # for access talk to someone with login rights to # pytest-dev@pytest.org to add your ssh key - rsync -avz _build/html/ pytest-dev@pytest.org:/www/pytest.org/$(SITETARGET) + rsync -avz _build/html/ pytest-dev@pytest.org:pytest.org/$(SITETARGET) installpdf: latexpdf - @scp $(BUILDDIR)/latex/pytest.pdf pytest-dev@pytest.org:/www/pytest.org/$(SITETARGET) + @scp $(BUILDDIR)/latex/pytest.pdf pytest-dev@pytest.org:pytest.org/$(SITETARGET) installall: clean install installpdf @echo "done" +regen: + PYTHONDONTWRITEBYTECODE=1 COLUMNS=76 regendoc --update *.txt */*.txt + html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo diff --git a/doc/en/_getdoctarget.py b/doc/en/_getdoctarget.py new file mode 100755 index 000000000..70427f745 --- /dev/null +++ b/doc/en/_getdoctarget.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import py + +def get_version_string(): + fn = py.path.local(__file__).join("..", "..", "..", + "_pytest", "__init__.py") + for line in fn.readlines(): + if "version" in line: + return eval(line.split("=")[-1]) + +def get_minor_version_string(): + return ".".join(get_version_string().split(".")[:2]) + +if __name__ == "__main__": + print (get_minor_version_string()) diff --git a/doc/en/conf.py b/doc/en/conf.py index c0c41edfa..3df505434 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -17,10 +17,13 @@ # # The full version, including alpha/beta/rc tags. # The short X.Y version. -version = "2.7" -release = "2.7.1.dev" -import sys, os +import os, sys +sys.path.insert(0, os.path.dirname(__file__)) +import _getdoctarget + +version = _getdoctarget.get_minor_version_string() +release = _getdoctarget.get_version_string() # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -54,7 +57,7 @@ master_doc = 'contents' # General information about the project. project = u'pytest' -copyright = u'2014, holger krekel' +copyright = u'2015, holger krekel and pytest-dev team' diff --git a/doc/en/release.txt b/doc/en/release.txt index fc8c1ffd4..fdb775dd1 100644 --- a/doc/en/release.txt +++ b/doc/en/release.txt @@ -1,39 +1,36 @@ pytest release checklist ------------------------- -For doing a release of pytest (status March 2015) holger does: +For doing a release of pytest (status April 2015) this checklist is used: -1. change version numbers in ``setup.py``, ``_pytest/__init__.py`` - to a final release version. +1. change version numbers in ``_pytest/__init__.py`` to the to-be-released version. + (the version number in ``setup.py`` reads from that init file as well) 2. finalize ``./CHANGELOG`` (don't forget the the header). 3. write ``doc/en/announce/release-VERSION.txt`` (usually copying from an earlier release version). -4. change ``version`` and ``release`` in doc/en/conf.py, set ``SITETARGET=latest`` - in ``doc/en/Makefile``. - -5. regenerate doc examples with ``tox -e regen`` and check with ``hg diff`` +4. regenerate doc examples with ``tox -e regen`` and check with ``hg diff`` if the differences show regressions. It's a bit of a manual process because there a large part of the diff is about pytest headers or differences in speed ("tests took X.Y seconds"). (XXX automate doc/example diffing to ignore such changes and integrate it into "tox -e regen"). -6. ``devpi upload`` to `your developer devpi index `_. You can create your own user and index on https://devpi.net, +5. ``devpi upload`` to `your developer devpi index `_. You can create your own user and index on https://devpi.net, an inofficial service from the devpi authors. -7. run ``devpi use INDEX`` and ``devpi test`` from linux and windows machines +6. run ``devpi use INDEX`` and ``devpi test`` from linux and windows machines and verify test results on the index. On linux typically all environments - pass (March 2015 there is a setup problem with a cx_freeze environment) + pass (April 2015 there is a setup problem with a cx_freeze environment) but on windows all involving ``pexpect`` fail because pexpect does not exist on windows and tox does not allow to have platform-specific environments. Also on windows ``py33-trial`` fails but should probably pass (March 2015). In any case, py26,py27,py33,py34 are required to pass for all platforms. -8. You can fix tests/code and repeat number 7. until everything passes. +7. You can fix tests/code and repeat number 6. until everything passes. -9. Once you have sufficiently passing tox tests you can do the actual release:: +8. Once you have sufficiently passing tox tests you can do the actual release:: cd doc/en/ make install @@ -44,12 +41,12 @@ For doing a release of pytest (status March 2015) holger does: hg tag VERSION hg push -10. send out release announcement to pytest-dev@python.org, +9. send out release announcement to pytest-dev@python.org, testing-in-python@lists.idyll.org and python-announce-list@python.org . -11. **after the release** bump the version numbers in ``setup.py``, +10. **after the release** bump the version numbers in ``setup.py``, ``_pytest/__init__.py``, ``doc/en/conf.py`` to the next Minor release version (i.e. if you released ``pytest-2.8.0``, set it to ``pytest-2.9.0.dev1``) and set ``SITETARGET=dev`` in ``doc/en/makefile``. Commit. -12. already done :) +11. already done :) diff --git a/setup.py b/setup.py index 0a3a4b10a..0e8b3509f 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,15 @@ 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 main(): install_requires = ['py>=1.4.25'] @@ -28,7 +37,7 @@ def main(): name='pytest', description='pytest: simple powerful testing with Python', long_description=long_description, - version='2.7.1.dev', + version=get_version(), url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],