classification
Title: distutils's checking for MSVC compiler
Type: behavior Stage:
Components: Versions: Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: jwfang, loewis
Priority: normal Keywords:

Created on 2012-05-03 03:10 by jwfang, last changed 2012-05-03 08:46 by loewis. This issue is now closed.

Messages (5)
msg159833 - (view) Author: jamesf (jwfang) Date: 2012-05-03 03:10
I am using python 2.7.2 installed via the pre-built installer package, and my SDK version is v7.1.

1) The MSSdk environment variable is not set by lastest SDK's SetEnv.cmd anymore, but distutils still check for it.

2) I have also install MSVC 2010 Express Edition, and its vcvarsall.bat
can't be found.

Off-side question:
a) Can i use different version of MSVC from which python is built for extension development ?
b) Can i use mingw compiler to develop extension for the pre-built windows binary python ?
msg159834 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-03 06:52
> 1) The MSSdk environment variable is not set by lastest SDK's 
> SetEnv.cmd anymore, but distutils still check for it.

This is intentional. Older SDKs still set the variable, so there
is nothing wrong with checking it.

> 2) I have also install MSVC 2010 Express Edition, and its 
> vcvarsall.bat can't be found.

MSVC 2010 is not supported for building Python 2.7 extension modules.

> a) Can i use different version of MSVC from which python is built for 
> extension development ?

No. Because of the way the MSVCRT works, this can cause crashes.

> b) Can i use mingw compiler to develop extension for the pre-built 
> windows binary python ?

Yes, in principle. In practice, it may fail because of gcc limitations.
msg159835 - (view) Author: jamesf (jwfang) Date: 2012-05-03 07:08
Thanks for your replying.

Here is my understanding of how the compiler chosen logic works, correct me if i am wrong:
1) If using MSVC, we should ALWAYS stick the compiler to the version which python was compiled with;
2) But we can change SDK version through DISTUTILS_USE_SDK with SetEnv.cmd already called.
3) It's the compiler version that matters, not SDK version.

But from distutils source:

if "DISTUTILS_USE_SDK" in os.environ and "MSSdk" in os.environ and ...:
                                    ^^^^^
does this mean i can not use lastest SDK since it does not set MSSdk variable?
msg159842 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-03 08:46
DISTUTILS_USE_SDK really means "shut up, I know what I'm doing". So if this is the case (i.e. you *really* know what you are doing), just set MsSdk as well.

I don't actually know whether the latest SDK is able to build correct extensions for Python 2.7 - I haven't looked at the latest SDK. It may be that MS stopped setting MsSdk for a reason.
msg159843 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-03 08:46
In any case, it appears that there is no bug report in this issue, so I'm closing this as "works for me".
History
Date User Action Args
2012-05-03 08:46:57loewissetstatus: open -> closed
resolution: works for me
messages: + msg159843
2012-05-03 08:46:04loewissetmessages: + msg159842
2012-05-03 07:08:17jwfangsetmessages: + msg159835
2012-05-03 06:52:49loewissetmessages: + msg159834
2012-05-03 06:40:29pitrousetnosy: + loewis
2012-05-03 03:10:44jwfangcreate