Browse Source

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
tags/0.5.20
Monty Taylor 6 years ago
parent
commit
c84876dc0f
3 changed files with 8 additions and 4 deletions
  1. 0
    3
      README.rst
  2. 1
    0
      pbr/tests/__init__.py
  3. 7
    1
      pbr/util.py

+ 0
- 3
README.rst View File

@@ -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::


+ 1
- 0
pbr/tests/__init__.py View File

@@ -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')

+ 7
- 1
pbr/util.py View File

@@ -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

Loading…
Cancel
Save