当前位置: 首页>>代码示例>>Python>>正文


Python Reg.read_keys方法代码示例

本文整理汇总了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)
开发者ID:Bitez,项目名称:GoogleMusic.bundle,代码行数:27,代码来源:test_msvc9compiler.py

示例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
开发者ID:aevitas,项目名称:wotsdk,代码行数:15,代码来源:teststest_msvc9compiler.py

示例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
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:17,代码来源:test_msvc9compiler.py

示例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)
开发者ID:1018365842,项目名称:FreeIMU,代码行数:19,代码来源:test_msvc9compiler.py

示例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")
开发者ID:davidstrauss,项目名称:pyside-setup,代码行数:60,代码来源:utils.py

示例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)
开发者ID:Kanma,项目名称:Athena-Dependencies-Python,代码行数:24,代码来源:test_msvc9compiler.py


注:本文中的distutils.msvc9compiler.Reg.read_keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。