From 1417c58ae1779600c17aed27d5ce7d4c63719dd4 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 5 Jul 2013 16:39:50 -0400 Subject: [PATCH] Clean up hacking and path issues with d2to1 We imported in another code base. It takes a little bit of path adjusting to get things right. Change-Id: Ifb96652c822d5d243a6bedb77bc34e919be2d3a8 --- README.rst | 23 +++++++++++++++++------ pbr/tests/test_version.py | 2 +- setup.cfg | 5 +++++ setup.py | 5 +++-- tox.ini | 2 +- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 146fa40..09e4135 100644 --- a/README.rst +++ b/README.rst @@ -13,9 +13,20 @@ it's simple and repeatable. If you want to do things differently, cool! But you've already got the power of python at your fingertips, so you don't really need PBR. -PBR builds on top of `d2to1` to provide for declarative configuration. It -then filters the `setup.cfg` data through a setup hook to fill in default -values and provide more sensible behaviors. +PBR builds on top of the work that `d2to1` started to provide for declarative +configuration. `d2to1` is itself an implementation of the ideas behind +`distutils2`. Although `distutils2` is now abandoned in favor of work towards +PEP 426 and Metadata 2.0, declarative config is still a great idea and +specifically important in trying to distribute setup code as a library +when that library itself will alter how the setup is processed. As Metadata +2.0 and other modern Python packaging PEPs come out, `pbr` aims to support +them as quickly as possible. + +`pbr` reads and then filters the `setup.cfg` data through a setup hook to +fill in default values and provide more sensible behaviors, and then feeds +the results in as the arguments to a call to `setup.py` - so the heavy +lifting of handling python packaging needs is still being done by +`setuptools`. Behaviors ========= @@ -124,11 +135,11 @@ The minimal setup.py should look something like this:: from setuptools import setup setup( - setup_requires=['d2to1', 'pbr'], - d2to1=True, + setup_requires=['pbr'], + pbr=True, ) -Note that it's important to specify `d2to1=True` or else the pbr functionality +Note that it's important to specify `pbr=True` or else the pbr functionality will not be enabled. It should also work fine if additional arguments are passed to `setup()`, diff --git a/pbr/tests/test_version.py b/pbr/tests/test_version.py index bd72a2d..7ef908b 100644 --- a/pbr/tests/test_version.py +++ b/pbr/tests/test_version.py @@ -28,4 +28,4 @@ class DeferredVersionTestCase(tests.BaseTestCase): deferred_string = MyVersionInfo("openstack").\ cached_version_string() - self.assertEquals("5.5.5.5", deferred_string) + self.assertEqual("5.5.5.5", deferred_string) diff --git a/setup.cfg b/setup.cfg index 80dcea4..87e820b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ summary = Python Build Reasonableness description-file = README.rst home-page = http://pypi.python.org/pypi/pbr +requires-python = >=2.6 classifier = Development Status :: 4 - Beta Environment :: Console @@ -26,3 +27,7 @@ setup-hooks = [pbr] warnerrors = True + +[entry_points] +distutils.setup_keywords = + pbr = pbr.core:pbr diff --git a/setup.py b/setup.py index dcc3d3e..c6c202a 100755 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ import setuptools +from pbr.d2to1 import util + setuptools.setup( - setup_requires=['d2to1>=0.2.10,<0.3'], - d2to1=True) + **util.cfg_to_args()) diff --git a/tox.ini b/tox.ini index 6d32c86..97d7a78 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = - python setup.py testr --slowest --testr-args='{posargs}' + python setup.py testr --testr-args='{posargs}' [tox:jenkins] sitepackages = True