versionutils

Helpers for comparing version strings.

New in version 1.6.

oslo_utils.versionutils.convert_version_to_int(version)

Convert a version to an integer.

version must be a string with dots or a tuple of integers.

New in version 2.0.

oslo_utils.versionutils.convert_version_to_str(version_int)

Convert a version integer to a string with dots.

New in version 2.0.

oslo_utils.versionutils.convert_version_to_tuple(version_str)

Convert a version string with dots to a tuple.

New in version 2.0.

oslo_utils.versionutils.is_compatible(requested_version, current_version, same_major=True)

Determine whether requested_version is satisfied by current_version; in other words, current_version is >= requested_version.

Parameters:
  • requested_version – version to check for compatibility

  • current_version – version to check against

  • same_major – if True, the major version must be identical between requested_version and current_version. This is used when a major-version difference indicates incompatibility between the two versions. Since this is the common-case in practice, the default is True.

Returns:

True if compatible, False if not