Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update msvc9_support.py #536

Closed
wants to merge 1 commit into from
Closed

Update msvc9_support.py #536

wants to merge 1 commit into from

Conversation

embray
Copy link
Contributor

@embray embray commented Apr 6, 2016

This module causes import setuptools to crash in mingw-w64's python, like so:

$ python -m setuptools
Traceback (most recent call last):
  File "C:/msys64/mingw64/lib/python2.7/runpy.py", line 151, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "C:/msys64/mingw64/lib/python2.7/runpy.py", line 109, in _get_module_details
    return _get_module_details(pkg_main_name)
  File "C:/msys64/mingw64/lib/python2.7/runpy.py", line 101, in _get_module_details
    loader = get_loader(mod_name)
  File "C:/msys64/mingw64/lib/python2.7/pkgutil.py", line 464, in get_loader
    return find_loader(fullname)
  File "C:/msys64/mingw64/lib/python2.7/pkgutil.py", line 474, in find_loader
    for importer in iter_importers(fullname):
  File "C:/msys64/mingw64/lib/python2.7/pkgutil.py", line 430, in iter_importers
    __import__(pkg)
  File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/__init__.py", line 14, in <module>
    from setuptools.extension import Extension
  File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/extension.py", line 11, in <module>
    from . import msvc9_support
  File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/msvc9_support.py", line 2, in <module>
    import distutils.msvc9compiler
  File "C:/msys64/mingw64/lib/python2.7/distutils/msvc9compiler.py", line 306, in <module>
    raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module

This is because distutils.msvccompiler parses sys.version to get the MSVC version that compiled Python--in this case MSVC was not used to build Python and for some reason this causes it to default to 6 which makes msvc9compiler to crash at import-time. Ouch!

This module causes `import setuptools` to crash in mingw-w64's python, like so:

```
$ python -m setuptools
Traceback (most recent call last):
  File "C:/msys64/mingw64/lib/python2.7/runpy.py", line 151, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "C:/msys64/mingw64/lib/python2.7/runpy.py", line 109, in _get_module_details
    return _get_module_details(pkg_main_name)
  File "C:/msys64/mingw64/lib/python2.7/runpy.py", line 101, in _get_module_details
    loader = get_loader(mod_name)
  File "C:/msys64/mingw64/lib/python2.7/pkgutil.py", line 464, in get_loader
    return find_loader(fullname)
  File "C:/msys64/mingw64/lib/python2.7/pkgutil.py", line 474, in find_loader
    for importer in iter_importers(fullname):
  File "C:/msys64/mingw64/lib/python2.7/pkgutil.py", line 430, in iter_importers
    __import__(pkg)
  File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/__init__.py", line 14, in <module>
    from setuptools.extension import Extension
  File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/extension.py", line 11, in <module>
    from . import msvc9_support
  File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/msvc9_support.py", line 2, in <module>
    import distutils.msvc9compiler
  File "C:/msys64/mingw64/lib/python2.7/distutils/msvc9compiler.py", line 306, in <module>
    raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
```

This is because `distutils.msvccompiler` parses `sys.version` to get the MSVC version that compiled Python--in this case MSVC was not used to build Python and for some reason this causes it to default to `6` which makes `msvc9compiler` to crash at import-time.  Ouch!
@jaraco
Copy link
Member

jaraco commented Apr 7, 2016

I'm inclined to simply trap Exception where it currently traps ImportError and leave the rest unchanged.

@jaraco jaraco closed this Apr 7, 2016
jaraco added a commit that referenced this pull request Apr 7, 2016
@embray
Copy link
Contributor Author

embray commented Apr 8, 2016

Either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants