本文整理汇总了Python中Windows.parse_windows_build方法的典型用法代码示例。如果您正苦于以下问题:Python Windows.parse_windows_build方法的具体用法?Python Windows.parse_windows_build怎么用?Python Windows.parse_windows_build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows
的用法示例。
在下文中一共展示了Windows.parse_windows_build方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: detectos
# 需要导入模块: import Windows [as 别名]
# 或者: from Windows import parse_windows_build [as 别名]
def detectos(required_ver, mock=False):
"""Returns boolean whether the detectos is compatible with the
current operating system, or the mock version, if given."""
# Do not compare as string because Windows 10 (build 10.0) comes after
# Windows 8.1 (build 6.3).
assert(isinstance(required_ver, (str, unicode)))
current_os = (mock if mock else Windows.parse_windows_build())
required_ver = required_ver.strip()
if required_ver.startswith('|'):
# This is the maximum version
# For example, |5.1 means Windows XP (5.1) but not Vista (6.0)
return current_os <= Windows.parse_windows_build(required_ver[1:])
elif required_ver.endswith('|'):
# This is the minimum version
# For example, 6.1| means Windows 7 or later
return current_os >= Windows.parse_windows_build(required_ver[:-1])
else:
# Exact version
return Windows.parse_windows_build(required_ver) == current_os