[pypy-svn] r79655 - in pypy/trunk/lib-python/modified-2.5.2/distutils: . tests

afa at codespeak.net afa at codespeak.net
Mon Nov 29 19:13:45 CET 2010


Author: afa
Date: Mon Nov 29 19:13:43 2010
New Revision: 79655

Modified:
   pypy/trunk/lib-python/modified-2.5.2/distutils/msvccompiler.py
   pypy/trunk/lib-python/modified-2.5.2/distutils/tests/test_msvccompiler.py
Log:
distutils.msvccompiler.MSVCCompiler should be importable on Unix. 


Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/msvccompiler.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/msvccompiler.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/msvccompiler.py	Mon Nov 29 19:13:43 2010
@@ -25,17 +25,20 @@
 from distutils import log
 from distutils.util import get_platform
 
-import _winreg
-
-RegOpenKeyEx = _winreg.OpenKeyEx
-RegEnumKey = _winreg.EnumKey
-RegEnumValue = _winreg.EnumValue
-RegError = _winreg.error
-
-HKEYS = (_winreg.HKEY_USERS,
-         _winreg.HKEY_CURRENT_USER,
-         _winreg.HKEY_LOCAL_MACHINE,
-         _winreg.HKEY_CLASSES_ROOT)
+try:
+    import _winreg
+except ImportError:
+    pass
+else:
+    RegOpenKeyEx = _winreg.OpenKeyEx
+    RegEnumKey = _winreg.EnumKey
+    RegEnumValue = _winreg.EnumValue
+    RegError = _winreg.error
+
+    HKEYS = (_winreg.HKEY_USERS,
+             _winreg.HKEY_CURRENT_USER,
+             _winreg.HKEY_LOCAL_MACHINE,
+             _winreg.HKEY_CLASSES_ROOT)
 
 VS_BASE = r"Software\Microsoft\VisualStudio\%0.1f"
 VSEXPRESS_BASE = r"Software\Microsoft\VCExpress\%0.1f"

Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/tests/test_msvccompiler.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/tests/test_msvccompiler.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/tests/test_msvccompiler.py	Mon Nov 29 19:13:43 2010
@@ -11,11 +11,15 @@
         else:
             self.fail("could not find a suitable manifest")
 
+class MsvcCompilerSimplerTestCase(unittest.TestCase):
+    def test_import_module(self):
+        from distutils.msvccompiler import MSVCCompiler
+
 def test_suite():
     if sys.platform == 'win32':
         return unittest.makeSuite(MsvcCompilerTestCase)
     else:
-        return unittest.TestSuite([])
+        return unittest.makeSuite(MsvcCompilerSimplerTestCase)
 
 if __name__ == "__main__":
     unittest.main(defaultTest="test_suite")



More information about the Pypy-commit mailing list