diff options
Diffstat (limited to 'pbr')
-rw-r--r-- | pbr/builddoc.py | 2 | ||||
-rw-r--r-- | pbr/git.py | 2 | ||||
-rw-r--r-- | pbr/hooks/commands.py | 1 | ||||
-rw-r--r-- | pbr/packaging.py | 27 | ||||
-rw-r--r-- | pbr/pbr_json.py | 2 | ||||
-rw-r--r-- | pbr/tests/test_commands.py | 8 | ||||
-rw-r--r-- | pbr/tests/test_setup.py | 2 | ||||
-rw-r--r-- | pbr/tests/test_util.py | 6 | ||||
-rw-r--r-- | pbr/tests/util.py | 6 | ||||
-rw-r--r-- | pbr/util.py | 5 |
10 files changed, 52 insertions, 9 deletions
diff --git a/pbr/builddoc.py b/pbr/builddoc.py index 33c85e8..605066e 100644 --- a/pbr/builddoc.py +++ b/pbr/builddoc.py @@ -1,4 +1,4 @@ -# Copyright 2011 OpenStack LLC. +# Copyright 2011 OpenStack Foundation # Copyright 2012-2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # @@ -1,4 +1,4 @@ -# Copyright 2011 OpenStack LLC. +# Copyright 2011 OpenStack Foundation # Copyright 2012-2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # diff --git a/pbr/hooks/commands.py b/pbr/hooks/commands.py index fd757e4..d9b56b5 100644 --- a/pbr/hooks/commands.py +++ b/pbr/hooks/commands.py @@ -43,6 +43,7 @@ class CommandsConfig(base.BaseConfig): self.add_command('pbr.packaging.LocalInstallScripts') self.add_command('pbr.packaging.LocalDevelop') self.add_command('pbr.packaging.LocalRPMVersion') + self.add_command('pbr.packaging.LocalDebVersion') if os.name != 'nt': easy_install.get_script_args = packaging.override_get_script_args diff --git a/pbr/packaging.py b/pbr/packaging.py index fd9ffbe..484cd24 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -1,4 +1,4 @@ -# Copyright 2011 OpenStack LLC. +# Copyright 2011 OpenStack Foundation # Copyright 2012-2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # @@ -225,6 +225,25 @@ class LocalRPMVersion(setuptools.Command): pass +class LocalDebVersion(setuptools.Command): + __doc__ = """Output the deb *compatible* version string of this package""" + description = __doc__ + + user_options = [] + command_name = "deb_version" + + def run(self): + log.info("[pbr] Extracting deb version") + name = self.distribution.get_name() + print(version.VersionInfo(name).semantic_version().debian_string()) + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def have_testr(): return testr_command.have_testr @@ -724,7 +743,11 @@ def get_version(package_name, pre_version=None): return version raise Exception("Versioning for this project requires either an sdist" " tarball, or access to an upstream git repository." - " Are you sure that git is installed?") + " It's also possible that there is a mismatch between" + " the package name in setup.cfg and the argument given" + " to pbr.version.VersionInfo. Project name {name} was" + " given, but was not able to be found.".format( + name=package_name)) # This is added because pbr uses pbr to install itself. That means that diff --git a/pbr/pbr_json.py b/pbr/pbr_json.py index 822014f..08c3da2 100644 --- a/pbr/pbr_json.py +++ b/pbr/pbr_json.py @@ -1,4 +1,4 @@ -# Copyright 2011 OpenStack LLC. +# Copyright 2011 OpenStack Foundation # Copyright 2012-2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # diff --git a/pbr/tests/test_commands.py b/pbr/tests/test_commands.py index 7f78adc..51e2711 100644 --- a/pbr/tests/test_commands.py +++ b/pbr/tests/test_commands.py @@ -57,6 +57,14 @@ class TestCommands(base.BaseTestCase): self.assertIn('Running custom build_py command.', stdout) self.assertEqual(0, return_code) + def test_custom_deb_version_py_command(self): + """Test custom deb_version command.""" + stdout, stderr, return_code = self.run_setup('deb_version') + self.addDetail('stdout', content.text_content(stdout)) + self.addDetail('stderr', content.text_content(stderr)) + self.assertIn('Extracting deb version', stdout) + self.assertEqual(0, return_code) + def test_custom_rpm_version_py_command(self): """Test custom rpm_version command.""" stdout, stderr, return_code = self.run_setup('rpm_version') diff --git a/pbr/tests/test_setup.py b/pbr/tests/test_setup.py index f5c101b..8e29b81 100644 --- a/pbr/tests/test_setup.py +++ b/pbr/tests/test_setup.py @@ -368,7 +368,7 @@ class WarnErrorSphinxTest(BaseSphinxTest): def app_init(appSelf, *args, **kwargs): self.assertTrue('warningiserror' in kwargs) - self.assertTrue(isinstance(kwargs['warningiserror'], bool)) + self.assertIsInstance(kwargs['warningiserror'], bool) self.assertTrue(kwargs['warningiserror']) appSelf.build = lambda *a, **b: None self.app_init_executed = True diff --git a/pbr/tests/test_util.py b/pbr/tests/test_util.py index 71ea92f..048b2b9 100644 --- a/pbr/tests/test_util.py +++ b/pbr/tests/test_util.py @@ -17,6 +17,7 @@ import textwrap import six from six.moves import configparser +import sys from pbr.tests import base from pbr import util @@ -61,7 +62,10 @@ class TestExtrasRequireParsingScenarios(base.BaseTestCase): def config_from_ini(self, ini): config = {} - parser = configparser.SafeConfigParser() + if sys.version_info >= (3, 2): + parser = configparser.ConfigParser() + else: + parser = configparser.SafeConfigParser() ini = textwrap.dedent(six.u(ini)) parser.readfp(io.StringIO(ini)) for section in parser.sections(): diff --git a/pbr/tests/util.py b/pbr/tests/util.py index e847746..0e7bcf1 100644 --- a/pbr/tests/util.py +++ b/pbr/tests/util.py @@ -42,6 +42,7 @@ import contextlib import os import shutil import stat +import sys try: import ConfigParser as configparser @@ -51,7 +52,10 @@ except ImportError: @contextlib.contextmanager def open_config(filename): - cfg = configparser.SafeConfigParser() + if sys.version_info >= (3, 2): + cfg = configparser.ConfigParser() + else: + cfg = configparser.SafeConfigParser() cfg.read(filename) yield cfg with open(filename, 'w') as fp: diff --git a/pbr/util.py b/pbr/util.py index 30853c6..22aa06e 100644 --- a/pbr/util.py +++ b/pbr/util.py @@ -204,7 +204,10 @@ def cfg_to_args(path='setup.cfg', script_args=()): """ # The method source code really starts here. - parser = configparser.SafeConfigParser() + if sys.version_info >= (3, 2): + parser = configparser.ConfigParser() + else: + parser = configparser.SafeConfigParser() if not os.path.exists(path): raise DistutilsFileError("file '%s' does not exist" % os.path.abspath(path)) |