本文整理汇总了Python中platform.win32_ver方法的典型用法代码示例。如果您正苦于以下问题:Python platform.win32_ver方法的具体用法?Python platform.win32_ver怎么用?Python platform.win32_ver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类platform
的用法示例。
在下文中一共展示了platform.win32_ver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def setUpClass(cls):
if 'libclang' in autowig.parser:
autowig.parser.plugin = 'libclang'
cls.srcdir = Path('fp17')
if not cls.srcdir.exists():
Repo.clone_from('https://github.com/StatisKit/FP17.git', cls.srcdir.relpath('.'), recursive=True)
cls.srcdir = cls.srcdir/'share'/'git'/'ClangLite'
cls.incdir = Path(sys.prefix).abspath()
if any(platform.win32_ver()):
cls.incdir = cls.incdir/'Library'
subprocess.check_output(['scons', 'cpp', '--prefix=' + str(cls.incdir)],
cwd=cls.srcdir)
if any(platform.win32_ver()):
cls.scons = subprocess.check_output(['where', 'scons.bat']).strip()
else:
cls.scons = subprocess.check_output(['which', 'scons']).strip()
cls.incdir = cls.incdir/'include'/'clanglite'
示例2: setUpClass
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def setUpClass(cls):
if 'libclang' in autowig.parser:
autowig.parser.plugin = 'libclang'
autowig.generator.plugin = 'boost_python_internal'
cls.srcdir = Path('fp17')
cls.prefix = Path(Path(sys.prefix).abspath())
if any(platform.win32_ver()):
cls.prefix = cls.prefix/'Library'
if not cls.srcdir.exists():
Repo.clone_from('https://github.com/StatisKit/FP17.git', cls.srcdir.relpath('.'), recursive=True)
if any(platform.win32_ver()):
cls.scons = subprocess.check_output(['where', 'scons.bat']).strip()
else:
cls.scons = subprocess.check_output(['which', 'scons']).strip()
if six.PY3:
cls.scons = cls.scons.decode("ascii", "ignore")
subprocess.check_output([cls.scons, 'cpp', '--prefix=' + str(cls.prefix)],
cwd=cls.srcdir)
cls.incdir = cls.prefix/'include'/'basic'
示例3: get_distribution
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def get_distribution():
if is_windows():
if sys.version_info[0] == 2:
import _winreg
else:
import winreg as _winreg
reg_key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion")
info = _winreg.QueryValueEx(reg_key, "ProductName")[0]
if info:
return info
else:
return "Windows {}".format(platform.win32_ver()[0])
elif is_linux():
from utils import lib
return "{} {}".format(*(lib.detect_distribution()))
elif is_darwin():
return "MacOS X {}".format(platform.mac_ver()[0])
return ""
示例4: set_os
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def set_os(self):
"""Collect human readable information about the OS version.
For Linux it is setting a distribution name and version.
"""
system, node, release, version, machine, processor = platform.uname()
if system == "Linux":
distribution_name, distribution_number, _ = distro.linux_distribution(
full_distribution_name=False
)
distribution_version = " ".join([distribution_name, distribution_number])
elif system == "Windows":
_release, distribution_version, _csd, _ptype = platform.win32_ver()
elif system == "Darwin":
distribution_version, _versioninfo, _machine = platform.mac_ver()
else:
distribution_version = release
self.metrics.mozphab.environment.distribution_version.set(distribution_version)
示例5: get_user_agent
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def get_user_agent(self) -> str:
vendor = ''
vendor_version = ''
try:
vendor = platform.system()
vendor_version = platform.release()
except OSError:
# If the calling process is handling SIGCHLD, platform.system() can
# fail with an IOError. See http://bugs.python.org/issue9127
pass
if vendor == "Linux":
vendor, vendor_version, dummy = distro.linux_distribution()
elif vendor == "Windows":
vendor_version = platform.win32_ver()[1]
elif vendor == "Darwin":
vendor_version = platform.mac_ver()[0]
return "{client_name} ({vendor}; {vendor_version})".format(
client_name=self.client_name,
vendor=vendor,
vendor_version=vendor_version,
)
示例6: print_configuration_info
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def print_configuration_info():
print('Test configuration:')
if sys.platform == 'darwin':
sys.path.append(os.path.abspath('test/lib'))
import TestMac
print(' Mac %s %s' % (platform.mac_ver()[0], platform.mac_ver()[2]))
print(' Xcode %s' % TestMac.Xcode.Version())
elif sys.platform == 'win32':
sys.path.append(os.path.abspath('pylib'))
import gyp.MSVSVersion
print(' Win %s %s\n' % platform.win32_ver()[0:2])
print(' MSVS %s' %
gyp.MSVSVersion.SelectVisualStudioVersion().Description())
elif sys.platform in ('linux', 'linux2'):
print(' Linux %s' % ' '.join(platform.linux_distribution()))
print(' Python %s' % platform.python_version())
print(' PYTHONPATH=%s' % os.environ['PYTHONPATH'])
print()
示例7: build
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def build(self):
if (any(platform.win32_ver())):
stroutput = self.remove_accents(self.output)
else:
stroutput = self.output
cmd = {'sender': self.sender,
'receiver': self.receiver,
'output': stroutput,
'cmd': self.cmd,
'jobid': self.jobid}
return base64.b64encode(json.dumps(cmd))
#------------------------------------------------------------------------------
# Class ChromePasswords
#------------------------------------------------------------------------------
示例8: is_win10_professional
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def is_win10_professional():
name = sys.platform
if name != 'win32':
return False
version = platform.win32_ver()[0]
if version == '10':
# for windows 10 only, we need to know if it's pro vs home
import winreg
with winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
r"SOFTWARE\Microsoft\Windows NT\CurrentVersion") as key:
return winreg.QueryValueEx(key, "EditionID")[0] == 'Professional'
return False
示例9: _os_info
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def _os_info() -> typing.Sequence[str]:
"""Get operating system info.
Return:
A list of lines with version info.
"""
lines = []
releaseinfo = None
if utils.is_linux:
osver = ''
releaseinfo = _release_info()
elif utils.is_windows:
osver = ', '.join(platform.win32_ver())
elif utils.is_mac:
release, info_tpl, machine = platform.mac_ver()
if all(not e for e in info_tpl):
versioninfo = ''
else:
versioninfo = '.'.join(info_tpl)
osver = ', '.join(e for e in [release, versioninfo, machine] if e)
elif utils.is_posix:
osver = ' '.join(platform.uname())
else:
osver = '?'
lines.append('OS Version: {}'.format(osver))
if releaseinfo is not None:
for (fn, data) in releaseinfo:
lines += ['', '--- {} ---'.format(fn), data]
return lines
示例10: __init__
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def __init__(self):
self.platform = platform.system()
self.version = platform.version()
self.release = platform.release()
self.python_version = platform.python_version()
try:
self.cpuinfo = [i.strip() for i in open(CPUINFO_FILE)]
except:
self.cpuinfo = []
def is_rpi_line(i):
return i.startswith('Hardware') and i.endswith('BCM2708')
self.is_raspberry_pi = any(is_rpi_line(i) for i in self.cpuinfo)
self.is_linux = (self.platform == 'linux')
platform_version = ()
if self.is_linux:
# Use the linux distribution as the name
self.platform = platform.linux_distribution()[0].lower()
elif self.platform == WINDOWS:
platform_version = platform.win32_ver()
elif self.platform == MAC:
release, versioninfo, machine = platform.mac_ver()
platform_version = release, machine
# https://boklee.blogspot.com/2012/05/how-to-retrieve-cpuinfo-on-os-x.html
for i in 'features', 'brand_string':
s = subprocess.check_output(('sysctl', 'machdep.cpu.' + i))
self.cpuinfo.append(s.decode().strip())
self.platform_version = ':'.join(platform_version)
示例11: from_current_system
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def from_current_system(cls, session=None):
"""Gets a Uname object populated from the current system"""
uname = platform.uname()
fqdn = socket.getfqdn()
system = uname[0]
architecture, _ = platform.architecture()
if system == "Windows":
service_pack = platform.win32_ver()[2]
kernel = uname[3] # 5.1.2600
release = uname[2] # XP, 2000, 7
version = uname[3] + service_pack # 5.1.2600 SP3, 6.1.7601 SP1
elif system == "Darwin":
kernel = uname[2] # 12.2.0
release = "OSX" # OSX
version = platform.mac_ver()[0] # 10.8.2
elif system == "Linux":
kernel = uname[2] # 3.2.5
release = platform.linux_distribution()[0] # Ubuntu
version = platform.linux_distribution()[1] # 12.04
# Emulate PEP 425 naming conventions - e.g. cp27-cp27mu-linux_x86_64.
pep425tag = "%s%s-%s-%s" % (pep425tags.get_abbr_impl(),
pep425tags.get_impl_ver(),
str(pep425tags.get_abi_tag()).lower(),
pep425tags.get_platform())
return cls.from_keywords(
session=session,
system=system,
architecture=architecture,
node=uname[1],
release=release,
version=version,
machine=uname[4], # x86, x86_64
kernel=kernel,
fqdn=fqdn,
pep425tag=pep425tag,
)
示例12: test_win32_ver
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def test_win32_ver(self):
res = platform.win32_ver()
示例13: about
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def about(application, appname=None, appversion=None):
data = []
if appname is not None:
data.append("{}{}".format(appname,
(" " + appversion) if appversion is not None else ""))
python = platform.python_implementation()
if python == "CPython":
python = python[1:]
data.append("{0} {1.major}.{1.minor}.{1.micro}".format(python,
sys.version_info))
data.append("Tk {}".format(application.tk.getvar(
"tk_patchLevel")))
system = platform.system()
if system == "Linux":
distro, version = platform.dist()[:2]
if distro:
system = "{}/{}".format(system, distro)
if version:
system += " " + version
elif system == "Windows":
version, service_pack = platform.win32_ver()[:2]
if version:
system = "{} {}".format(system, version)
if service_pack:
system += " (SP {})".format(service_pack)
elif system == "Mac":
version, info = platform.mac_ver()
if version:
system = "{} {}".format(system, version)
if info:
system += "." + info[0]
return " • ".join(data) + "\n" + system + " • " + platform.machine()
# No shortcuts on Mac OS X
示例14: getCurrentDef
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def getCurrentDef(normname):
bname, wver, stuff, whichkern = platform.win32_ver()
wvertup = wver.split('.')
arch = envi.getCurrentArch()
if isSysWow64():
arch = 'wow64'
modname = 'vstruct.defs.windows.win_%s_%s_%s.%s' % (wvertup[0], wvertup[1], arch, normname)
try:
mod = __import__(modname, {}, {}, 1)
except ImportError, e:
mod = None
示例15: print_sysinfo
# 需要导入模块: import platform [as 别名]
# 或者: from platform import win32_ver [as 别名]
def print_sysinfo():
import collections
import datetime
import getpass
import platform
info = collections.OrderedDict()
info['OS'] = platform.system()
if psutil.OSX:
info['version'] = str(platform.mac_ver())
elif psutil.WINDOWS:
info['version'] = ' '.join(map(str, platform.win32_ver()))
if hasattr(platform, 'win32_edition'):
info['edition'] = platform.win32_edition()
else:
info['version'] = platform.version()
if psutil.POSIX:
info['kernel'] = '.'.join(map(str, get_kernel_version()))
info['arch'] = ', '.join(
list(platform.architecture()) + [platform.machine()])
info['hostname'] = platform.node()
info['python'] = ', '.join([
platform.python_implementation(),
platform.python_version(),
platform.python_compiler()])
if psutil.POSIX:
s = platform.libc_ver()[1]
if s:
info['glibc'] = s
info['fs-encoding'] = sys.getfilesystemencoding()
info['time'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
info['user'] = getpass.getuser()
info['pid'] = os.getpid()
print("=" * 70) # NOQA
for k, v in info.items():
print("%-14s %s" % (k + ':', v)) # NOQA
print("=" * 70) # NOQA