From 57ff99e246a2fdb3d59e7aa977fe3b1e00924c99 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Sep 2014 18:38:39 -0400 Subject: Grab winreg module from distutils.msvc9compiler --- setuptools/tests/test_msvc9compiler.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'setuptools/tests/test_msvc9compiler.py') diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 74b5220b..8f71c3d5 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -12,11 +12,6 @@ import tempfile import unittest import distutils.errors -try: - from winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE -except ImportError: - from _winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE - import distutils.msvc9compiler # importing only setuptools should apply the patch @@ -36,9 +31,12 @@ class MockReg: self.original_read_keys = distutils.msvc9compiler.Reg.read_keys self.original_read_values = distutils.msvc9compiler.Reg.read_values + _winreg = getattr(distutils.msvc9compiler, '_winreg', None) + winreg = getattr(distutils.msvc9compiler, 'winreg', _winreg) + hives = { - HKEY_CURRENT_USER: self.hkcu, - HKEY_LOCAL_MACHINE: self.hklm, + winreg.HKEY_CURRENT_USER: self.hkcu, + winreg.HKEY_LOCAL_MACHINE: self.hklm, } def read_keys(cls, base, key): -- cgit v1.2.3