本文整理匯總了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