本文整理汇总了Python中distutils.msvc9compiler.Reg.read_keys方法的典型用法代码示例。如果您正苦于以下问题:Python Reg.read_keys方法的具体用法?Python Reg.read_keys怎么用?Python Reg.read_keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.msvc9compiler.Reg
的用法示例。
在下文中一共展示了Reg.read_keys方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reg_class
# 需要导入模块: from distutils.msvc9compiler import Reg [as 别名]
# 或者: from distutils.msvc9compiler.Reg import read_keys [as 别名]
def test_reg_class(self):
if sys.platform != 'win32':
# this test is only for win32
return
from distutils.msvccompiler import get_build_version
if get_build_version() < 8.0:
# this test is only for MSVC8.0 or above
return
from distutils.msvc9compiler import Reg
self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')
# looking for values that should exist on all
# windows registeries versions.
path = r'Software\Microsoft\Notepad'
v = Reg.get_value(path, u"lfitalic")
self.assertTrue(v in (0, 1))
import _winreg
HKCU = _winreg.HKEY_CURRENT_USER
keys = Reg.read_keys(HKCU, 'xxxx')
self.assertEquals(keys, None)
keys = Reg.read_keys(HKCU, r'Software\Microsoft')
self.assertTrue('Notepad' in keys)
示例2: test_reg_class
# 需要导入模块: from distutils.msvc9compiler import Reg [as 别名]
# 或者: from distutils.msvc9compiler.Reg import read_keys [as 别名]
def test_reg_class(self):
from distutils.msvc9compiler import Reg
self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')
path = 'Control Panel\\Desktop'
v = Reg.get_value(path, u'dragfullwindows')
self.assertIn(v, (u'0', u'1', u'2'))
import _winreg
HKCU = _winreg.HKEY_CURRENT_USER
keys = Reg.read_keys(HKCU, 'xxxx')
self.assertEqual(keys, None)
keys = Reg.read_keys(HKCU, 'Control Panel')
self.assertIn('Desktop', keys)
return
示例3: test_reg_class
# 需要导入模块: from distutils.msvc9compiler import Reg [as 别名]
# 或者: from distutils.msvc9compiler.Reg import read_keys [as 别名]
def test_reg_class(self):
from distutils.msvc9compiler import Reg
self.assertRaises(KeyError, Reg.get_value, "xxx", "xxx")
path = "Control Panel\\Desktop"
v = Reg.get_value(path, u"dragfullwindows")
self.assertIn(v, (u"0", u"1", u"2"))
import _winreg
HKCU = _winreg.HKEY_CURRENT_USER
keys = Reg.read_keys(HKCU, "xxxx")
self.assertEqual(keys, None)
keys = Reg.read_keys(HKCU, "Control Panel")
self.assertIn("Desktop", keys)
return
示例4: test_reg_class
# 需要导入模块: from distutils.msvc9compiler import Reg [as 别名]
# 或者: from distutils.msvc9compiler.Reg import read_keys [as 别名]
def test_reg_class(self):
from distutils.msvc9compiler import Reg
self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')
# looking for values that should exist on all
# windows registeries versions.
path = r'Control Panel\Desktop'
v = Reg.get_value(path, u'dragfullwindows')
self.assertTrue(v in (u'0', u'1', u'2'))
import _winreg
HKCU = _winreg.HKEY_CURRENT_USER
keys = Reg.read_keys(HKCU, 'xxxx')
self.assertEqual(keys, None)
keys = Reg.read_keys(HKCU, r'Control Panel')
self.assertTrue('Desktop' in keys)
示例5: winsdk_setenv
# 需要导入模块: from distutils.msvc9compiler import Reg [as 别名]
# 或者: from distutils.msvc9compiler.Reg import read_keys [as 别名]
def winsdk_setenv(platform_arch, build_type):
from distutils.msvc9compiler import VERSION as MSVC_VERSION
from distutils.msvc9compiler import Reg
from distutils.msvc9compiler import HKEYS
from distutils.msvc9compiler import WINSDK_BASE
sdk_version_map = {
"v6.0a": 9.0,
"v6.1": 9.0,
"v7.0": 9.0,
"v7.0a": 10.0,
"v7.1": 10.0
}
log.info("Searching Windows SDK with MSVC compiler version %s" % MSVC_VERSION)
setenv_paths = []
for base in HKEYS:
sdk_versions = Reg.read_keys(base, WINSDK_BASE)
if sdk_versions:
for sdk_version in sdk_versions:
installationfolder = Reg.get_value(WINSDK_BASE + "\\" +
sdk_version, "installationfolder")
productversion = Reg.get_value(WINSDK_BASE + "\\" +
sdk_version, "productversion")
setenv_path = os.path.join(installationfolder, os.path.join(
'bin', 'SetEnv.cmd'))
if not os.path.exists(setenv_path):
continue
if not sdk_version in sdk_version_map:
continue
if sdk_version_map[sdk_version] != MSVC_VERSION:
continue
setenv_paths.append(setenv_path)
if len(setenv_paths) == 0:
raise DistutilsSetupError(
"Failed to find the Windows SDK with MSVC compiler version %s"
% MSVC_VERSION)
for setenv_path in setenv_paths:
log.info("Found %s" % setenv_path)
# Get SDK env (use latest SDK version installed on system)
setenv_path = setenv_paths[-1]
log.info("Using %s " % setenv_path)
build_arch = "/x86" if platform_arch.startswith("32") else "/x64"
build_type = "/Debug" if build_type.lower() == "debug" else "/Release"
setenv_cmd = [setenv_path, build_arch, build_type]
setenv_env = get_environment_from_batch_command(setenv_cmd)
setenv_env_paths = os.pathsep.join([setenv_env[k] for k in setenv_env if k.upper() == 'PATH']).split(os.pathsep)
setenv_env_without_paths = dict([(k, setenv_env[k]) for k in setenv_env if k.upper() != 'PATH'])
# Extend os.environ with SDK env
log.info("Initializing Windows SDK env...")
update_env_path(setenv_env_paths)
for k in sorted(setenv_env_without_paths):
v = setenv_env_without_paths[k]
log.info("Inserting \"%s = %s\" to environment" % (k, v))
os.environ[k] = v
log.info("Done initializing Windows SDK env")
示例6: test_reg_class
# 需要导入模块: from distutils.msvc9compiler import Reg [as 别名]
# 或者: from distutils.msvc9compiler.Reg import read_keys [as 别名]
def test_reg_class(self):
from distutils.msvccompiler import get_build_version
if get_build_version() < 8.0:
# this test is only for MSVC8.0 or above
return
from distutils.msvc9compiler import Reg
self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')
# looking for values that should exist on all
# windows registeries versions.
path = r'Control Panel\Desktop'
v = Reg.get_value(path, 'dragfullwindows')
self.assertTrue(v in ('0', '1', '2'))
import winreg
HKCU = winreg.HKEY_CURRENT_USER
keys = Reg.read_keys(HKCU, 'xxxx')
self.assertEquals(keys, None)
keys = Reg.read_keys(HKCU, r'Control Panel')
self.assertTrue('Desktop' in keys)