Expose deb version to match exposing rpm version
It seems like we only (currently) exposed to rpm version translation command when the deb version translation command is equally useful (for those that package deb things). Change-Id: I0df175e5206d9d3a806bf33c486765ad1aa8aa6b
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user