本文整理汇总了Python中tag.Tag.minor_bump方法的典型用法代码示例。如果您正苦于以下问题:Python Tag.minor_bump方法的具体用法?Python Tag.minor_bump怎么用?Python Tag.minor_bump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tag.Tag
的用法示例。
在下文中一共展示了Tag.minor_bump方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tag import Tag [as 别名]
# 或者: from tag.Tag import minor_bump [as 别名]
class VersionRequirement:
def __init__(self, dependence, name, operator, version):
self.dependence = dependence
self.name = name
self.operator = operator
self.version = version
self.store_versions()
def store_versions(self):
op = self.operator
if op == "=":
self.min_version = Tag(self.version)
self.max_version = Tag(self.version)
elif op == ">":
self.min_version = Tag(self.version)
self.min_version.increment()
self.max_version = Tag.max_tag()
elif op == ">=":
self.min_version = Tag(self.version)
self.max_version = Tag.max_tag()
elif op == "<":
self.min_version = Tag.min_tag()
self.max_version = Tag(self.version)
self.max_version.decrement()
elif op == "<=":
self.min_version = Tag.min_tag()
self.max_version = Tag(self.version)
elif op == "~>":
version_nums = self.version.split(".")
length = len(version_nums)
while len(version_nums) < 3:
version_nums.append("0")
version_str = ".".join(version_nums)
self.min_version = Tag(version_str)
if length == 1:
self.max_version = Tag.max_tag()
else:
self.max_version = Tag(version_str)
if length == 2: self.max_version.major_bump()
elif length == 3: self.max_version.minor_bump()
self.max_version.decrement()
else:
raise Exception("Error: unknown version constraint: %s" % operator)
def compatible_with(self, other):
return ((self.min_version <= other.max_version) and
(self.max_version >= other.min_version))