def is_compatible(self, platform_version, inclusive=False): """ Checks if a release is compatible with a platform version :param platform_version: the platform version, not required to be semver compatible :param inclusive: if True the check will also return True if an app requires 9.0.1 and the given platform version is 9.0 :return: True if compatible, otherwise false """ min_version = Version(pad_min_version(platform_version)) spec = Spec(self.platform_version_spec) if inclusive: max_version = Version(pad_max_inc_version(platform_version)) return (min_version in spec or max_version in spec) else: return min_version in spec
def is_compatible(self, platform_version, inclusive=False): """Checks if a release is compatible with a platform version :param platform_version: the platform version, not required to be semver compatible :param inclusive: if True the check will also return True if an app requires 9.0.1 and the given platform version is 9.0 :return: True if compatible, otherwise false """ min_version = Version(pad_min_version(platform_version)) spec = Spec(self.platform_version_spec) if inclusive: max_version = Version(pad_max_inc_version(platform_version)) return (min_version in spec or max_version in spec) else: return min_version in spec
def test_pad_inc_maximum(self): self.assertEqual('*', pad_max_inc_version('')) self.assertEqual('9.%i.%i' % (maxsize, maxsize), pad_max_inc_version('9')) self.assertEqual('9.0.%i' % maxsize, pad_max_inc_version('9.0')) self.assertEqual('9.0.0', pad_max_inc_version('9.0.0'))