versionutils

Helpers for comparing version strings.

Added in version 1.6.

class oslo_utils.versionutils.VersionPredicate(predicate_str)

Parse version predicate and check version requirements

This is based on the implementation of distutils.VersionPredicate

Added in version 7.4.

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.

Added in version 2.0.

oslo_utils.versionutils.convert_version_to_str(version_int)

Convert a version integer to a string with dots.

Added in version 2.0.

oslo_utils.versionutils.convert_version_to_tuple(version_str)

Convert a version string with dots to a tuple.

Added 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