[openstack-dev] How do I calculate the semantic version prior to a release?

Neil Jerram Neil.Jerram at metaswitch.com
Fri Feb 26 11:27:05 UTC 2016

On 26/02/16 11:16, Neil Jerram wrote:
> I understand the semantic versioning algorithm for calculating a new
> version.  But what do I run, in a git repository, to do that calculation
> for me, and output:
> - the new semantic version that would be used if I asked for a formal
> release to PyPI
> - the corresponding Debian version
> - the corresponding RPM version.
> Thanks,
> 	Neil

The following seems to work, but is it the best way?

from pbr import version

v = version.VersionInfo('networking-calico').semantic_version()
print v.release_string()
print v.brief_string()
print v.debian_string()
print v.rpm_string()


More information about the OpenStack-dev mailing list