summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2015-07-12 21:29:28 +1200
committerRobert Collins <robertc@robertcollins.net>2015-07-12 21:29:28 +1200
commit446762bcdb7c0f44d52610c102f1e4bb7343a1f4 (patch)
tree317e4808c1ca7afd5b2e3bdf293f4132cd0c8869
parentb4f9df3b93239da17ffc6359b2085dfb85922a1c (diff)
downloadtestrepository-446762bcdb7c0f44d52610c102f1e4bb7343a1f4.tar.gz
Migrate to pbr for build management
Reduce manual maintenance by using pbr.
-rw-r--r--.gitignore6
-rw-r--r--Makefile9
-rw-r--r--NEWS3
-rw-r--r--README.rst (renamed from README.txt)3
-rw-r--r--doc/conf.py6
-rw-r--r--requirements.txt4
-rwxr-xr-xsetup.cfg40
-rwxr-xr-xsetup.py114
-rwxr-xr-xtestr5
-rw-r--r--testrepository/__init__.py18
-rw-r--r--testrepository/commands/__init__.py5
-rw-r--r--testrepository/tests/test_setup.py6
12 files changed, 85 insertions, 134 deletions
diff --git a/.gitignore b/.gitignore
index 39a284b..adebceb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,9 @@ __pycache__
*.pyc
*~
.*.swp
+*.egg/
+*.pyc
+AUTHORS
+ChangeLog
+.tox
+doc/build/
diff --git a/Makefile b/Makefile
index b05b894..57ec722 100644
--- a/Makefile
+++ b/Makefile
@@ -14,10 +14,13 @@
all: README.txt check
+editable:
+ pip install -e .[test]
+
.testrepository:
./testr init
-check: .testrepository
+check: editable .testrepository
./testr run --parallel
check-xml:
@@ -26,7 +29,7 @@ check-xml:
release:
./setup.py sdist upload --sign
-README.txt: testrepository/commands/quickstart.py
+README.txt: editable testrepository/commands/quickstart.py
./testr quickstart > $@
-.PHONY: check check-xml release all
+.PHONY: check check-xml editable release all
diff --git a/NEWS b/NEWS
index 536308c..d366398 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ CHANGES
* Isolate the testrepository test suite from the chunking (or otherwise)
behaviour of testtools' exception handlers. (Robert Collins)
+* pbr is now used to manage build and release tooling.
+ (Monty Taylor, Robert Collins)
+
0.0.20
++++++
diff --git a/README.txt b/README.rst
index 3111bb5..e086b40 100644
--- a/README.txt
+++ b/README.rst
@@ -1,6 +1,9 @@
Test Repository
+++++++++++++++
+.. image:: https://travis-ci.org/testing-cabal/mock.svg?branch=master
+ :target: https://travis-ci.org/testing-cabal/mock
+
Overview
~~~~~~~~
diff --git a/doc/conf.py b/doc/conf.py
index c9076dd..c482fbe 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -48,9 +48,9 @@ copyright = u'2012, Testrepository Contributors'
# built documents.
#
# The short X.Y version.
-version = 'trunk'
+# version = 'trunk'
# The full version, including alpha/beta/rc tags.
-release = 'trunk'
+# release = 'trunk'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -91,7 +91,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
-html_theme = 'default'
+html_theme = 'nature'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..43f123d
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+pbr>=1.3
+fixtures
+python-subunit >= 0.0.18
+testtools >= 0.9.30
diff --git a/setup.cfg b/setup.cfg
new file mode 100755
index 0000000..6208476
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,40 @@
+[metadata]
+name = testrepository
+author = Robert Collins
+author_email = robertc@robertcollins.net
+home-page = https://launchpad.net/testrepository
+summary = A repository of test results.
+description-file = README.rst
+classifiers =
+ Development Status :: 6 - Mature
+ Intended Audience :: Developers
+ License :: OSI Approved :: BSD License
+ License :: OSI Approved :: Apache Software License
+ Operating System :: OS Independent
+ Programming Language :: Python
+ Programming Language :: Python :: 2
+ Programming Language :: Python :: 3
+ Topic :: Software Development :: Quality Assurance
+ Topic :: Software Development :: Testing
+keyword = subunit, unittest, testrunner
+
+[extras]
+test =
+ pytz
+ testresources
+ testscenarios
+docs =
+ jinja2<2.7:python_version<"3.3" and python_version>="3"
+ Pygments<2:python_version<"3.3" and python_version>="3"
+ sphinx<1.3:python_version<"3.3" and python_version>="3"
+ sphinx:python_version<"3" or python_version>="3.3"
+
+[files]
+scripts =
+
+[entry_points]
+distutils.commands =
+ testr = testrepository.setuptools_command:Testr
+console_scripts =
+ testr = testrepository.commands:main
+
diff --git a/setup.py b/setup.py
index 16615b5..940c636 100755
--- a/setup.py
+++ b/setup.py
@@ -1,115 +1,5 @@
#!/usr/bin/env python
-#
-# Copyright (c) 2009-2013 Testrepository Contributors
-#
-# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
-# license at the users choice. A copy of both licenses are available in the
-# project source as Apache-2.0 and BSD. You may not use this file except in
-# compliance with one of these two licences.
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# license you chose for the specific language governing permissions and
-# limitations under that license.
-from setuptools import setup
-import email
-import os
+import setuptools
-import testrepository
-
-
-def get_revno():
- import bzrlib.workingtree
- t = bzrlib.workingtree.WorkingTree.open_containing(__file__)[0]
- return t.branch.revno()
-
-
-def get_version_from_pkg_info():
- """Get the version from PKG-INFO file if we can."""
- pkg_info_path = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
- try:
- pkg_info_file = open(pkg_info_path, 'r')
- except (IOError, OSError):
- return None
- try:
- pkg_info = email.message_from_file(pkg_info_file)
- except email.MessageError:
- return None
- return pkg_info.get('Version', None)
-
-
-def get_version():
- """Return the version of testrepository that we are building."""
- version = '.'.join(
- str(component) for component in testrepository.__version__[0:3])
- phase = testrepository.__version__[3]
- if phase == 'final':
- return version
- pkg_info_version = get_version_from_pkg_info()
- if pkg_info_version:
- return pkg_info_version
- revno = get_revno()
- if phase == 'alpha':
- # No idea what the next version will be
- return 'next-r%s' % revno
- else:
- # Preserve the version number but give it a revno prefix
- return version + '-r%s' % revno
-
-
-description = open(os.path.join(os.path.dirname(__file__), 'README.txt'), 'rt').read()
-
-
-setup(name='testrepository',
- author='Robert Collins',
- author_email='robertc@robertcollins.net',
- url='https://launchpad.net/testrepository',
- description='A repository of test results.',
- long_description=description,
- keywords="subunit unittest testrunner",
- classifiers = [
- 'Development Status :: 6 - Mature',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: BSD License',
- 'License :: OSI Approved :: Apache Software License',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 3',
- 'Topic :: Software Development :: Quality Assurance',
- 'Topic :: Software Development :: Testing',
- ],
- scripts=['testr'],
- version=get_version(),
- packages=[
- 'testrepository',
- 'testrepository.arguments',
- 'testrepository.commands',
- 'testrepository.repository',
- 'testrepository.tests',
- 'testrepository.tests.arguments',
- 'testrepository.tests.commands',
- 'testrepository.tests.repository',
- 'testrepository.tests.ui',
- 'testrepository.ui',
- ],
- install_requires=[
- 'fixtures',
- 'python-subunit >= 0.0.18',
- 'testtools >= 0.9.30',
- ],
- extras_require = dict(
- test=[
- 'bzr',
- 'pytz',
- 'testresources',
- 'testscenarios',
- ]
- ),
- entry_points={
- 'distutils.commands': [
- 'testr = testrepository.setuptools_command:Testr',
- ],
- },
- )
+setuptools.setup(setup_requires=['pbr>=1.3'], pbr=True)
diff --git a/testr b/testr
index 5ce42de..6e72414 100755
--- a/testr
+++ b/testr
@@ -13,7 +13,10 @@
# license you chose for the specific language governing permissions and
# limitations under that license.
-"""The CLI entry point to testrepository.
+"""Convenience local CLI entry point to testrepository.
+
+Primary CLI usage is via setuptools console_script entrypoint
+testrepository.commands:main
No program logic is in this script - see testrepository.commands.run_argv.
"""
diff --git a/testrepository/__init__.py b/testrepository/__init__.py
index 2c41a6e..9e9fa5d 100644
--- a/testrepository/__init__.py
+++ b/testrepository/__init__.py
@@ -22,15 +22,9 @@ The repository package contains the core storage code.
The tests package contains tests and test specific support code.
"""
-# same format as sys.version_info: "A tuple containing the five components of
-# the version number: major, minor, micro, releaselevel, and serial. All
-# values except releaselevel are integers; the release level is 'alpha',
-# 'beta', 'candidate', or 'final'. The version_info value corresponding to the
-# Python version 2.0 is (2, 0, 0, 'final', 0)." Additionally we use a
-# releaselevel of 'dev' for unreleased under-development code.
-#
-# If the releaselevel is 'alpha' then the major/minor/micro components are not
-# established at this point, and setup.py will use a version of next-$(revno).
-# If the releaselevel is 'final', then the tarball will be major.minor.micro.
-# Otherwise it is major.minor.micro~$(revno).
-__version__ = (0, 0, 20, 'final', 0)
+# Yes, this is not PEP-396 compliant. It predates that.
+from pbr.version import VersionInfo
+
+_v = VersionInfo('mock').semantic_version()
+version = _v.release_string()
+__version__ = _v.version_tuple()
diff --git a/testrepository/commands/__init__.py b/testrepository/commands/__init__.py
index 8863cea..8bf505c 100644
--- a/testrepository/commands/__init__.py
+++ b/testrepository/commands/__init__.py
@@ -211,3 +211,8 @@ def get_command_parser(cmd):
}
parser.set_usage(usage)
return parser
+
+
+def main():
+ # Setuptools console_scripts entry point
+ return run_argv(sys.argv, sys.stdin, sys.stdout, sys.stderr)
diff --git a/testrepository/tests/test_setup.py b/testrepository/tests/test_setup.py
index fdddb81..ecefb8e 100644
--- a/testrepository/tests/test_setup.py
+++ b/testrepository/tests/test_setup.py
@@ -41,12 +41,12 @@ class TestCanSetup(TestCase):
DocTestMatches("""...
running install_scripts
...
-adding '...testr'
+Installing testr script...
...""", doctest.ELLIPSIS),
# unixen
DocTestMatches("""...
-...bin/testr ...
-""", doctest.ELLIPSIS)
+Installing testr script to build/.../bin
+...""", doctest.ELLIPSIS)
))
self.assertEqual(0, proc.returncode,
"Setup failed out=%r err=%r" % (output, err))