summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2013-07-21 09:35:17 -0700
committerMonty Taylor <mordred@inaugust.com>2013-07-21 11:41:34 -0700
commitc84876dc0f559a66fec19b2f81f5717204b253e2 (patch)
treebfc85ea4893b5a82c3e5263d9459b80590262f56
parent71bea435b6f73644d5d7320001ac56d78bcc4687 (diff)
downloadpbr-c84876dc0f559a66fec19b2f81f5717204b253e2.tar.gz
Remove the need to specify the pbr hook
If you're running pbr codepaths, you want the hook. There is no need to say "pbr=True" in setup.py and then to list the hook in setup.cfg now that d2to1 is in the tree. Change-Id: Ie33d3e08d5a4133f5caf2613859919ce4f02c4a0
-rw-r--r--README.rst3
-rw-r--r--pbr/tests/__init__.py1
-rw-r--r--pbr/util.py8
3 files changed, 8 insertions, 4 deletions
diff --git a/README.rst b/README.rst
index 09e4135..ecdbb9a 100644
--- a/README.rst
+++ b/README.rst
@@ -124,9 +124,6 @@ A simple sample can be found in pbr s own setup.cfg
[files]
packages =
oslo
- [hooks]
- setup-hooks =
- pbr.hooks.setup_hook
The minimal setup.py should look something like this::
diff --git a/pbr/tests/__init__.py b/pbr/tests/__init__.py
index 5109b0f..a4874c3 100644
--- a/pbr/tests/__init__.py
+++ b/pbr/tests/__init__.py
@@ -79,6 +79,7 @@ class BaseTestCase(testtools.TestCase, testresources.ResourcedTestCase):
self.useFixture(fixtures.NestedTempfile())
self.useFixture(fixtures.FakeLogger())
+ self.useFixture(fixtures.EnvironmentVariable('PBR_VERSION', '0.0'))
self.temp_dir = self.useFixture(fixtures.TempDir()).path
self.package_dir = os.path.join(self.temp_dir, 'testpackage')
diff --git a/pbr/util.py b/pbr/util.py
index 353635e..3faa58e 100644
--- a/pbr/util.py
+++ b/pbr/util.py
@@ -77,6 +77,7 @@ try:
except ImportError:
import ConfigParser as configparser
+import pbr.hooks
# A simplified RE for this; just checks that the line ends with version
# predicates in ()
@@ -219,7 +220,9 @@ def cfg_to_args(path='setup.cfg'):
try:
if setup_hooks:
- setup_hooks = split_multiline(setup_hooks)
+ setup_hooks = [
+ hook for hook in split_multiline(setup_hooks)
+ if hook != 'pbr.hook.setup_hook']
for hook in setup_hooks:
hook_fn = resolve_name(hook)
try :
@@ -233,6 +236,9 @@ def cfg_to_args(path='setup.cfg'):
log.error(traceback.format_exc())
sys.exit(1)
+ # Run the pbr hook
+ pbr.hooks.setup_hook(config)
+
kwargs = setup_cfg_to_setup_kwargs(config)
# Set default config overrides