classification
Title: distutils does not show any error msg when can't build C module extensions due to a missing C compiler
Type: behavior Stage: patch review
Components: Distutils, Distutils2 Versions: Python 3.2, Python 3.1, Python 2.7, 3rd party
process
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: amaury.forgeotdarc, eric.araujo, giampaolo.rodola, jafo, loewis, tarek
Priority: normal Keywords: patch

Created on 2009-01-13 17:31 by giampaolo.rodola, last changed 2010-11-06 12:12 by giampaolo.rodola.

Files
File name Uploaded Description Edit
distutils_ioerror.patch amaury.forgeotdarc, 2009-01-14 10:25 review
Messages (9)
msg79751 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) (Python committer) Date: 2009-01-13 17:31
Today I was trying to compile a module using an extension in C and
noticed there are differences between compiling it on Python 2.5 and 2.6.
I was trying to compile psutil (svn checkout
http://psutil.googlecode.com/svn/trunk/ psutil) but I think that the
problem may occur with any other package using C extensions.

Python 2.5:

D:\pyftpdlib\svn\psutil\trunk>C:\python25\python.exe setup.py install
running install
running build
running build_ext
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible
binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin
installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.



Python 2.6:

D:\pyftpdlib\svn\psutil\trunk>C:\python26\python.exe setup.py install
running install
running build
running build_ext
building 'psutil/_psutil_mswindows' extension
error: None
msg79767 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-13 18:52
What is the specific error you are reporting?
msg79769 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) (Python committer) Date: 2009-01-13 18:57
Currently I haven't any C compiler installed on my system so I expect
distutils to report that every time I try to compile a C module extension.
Python 2.5 did that while Python 2.6 does not.
msg79845 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-01-14 10:25
The problem has two causes:
- IOError is raised when no compiler is found. DistutilsPlatformError
should be used instead, this was fixed by #4702.

- the distutils.util.grok_environment_error function transforms a
IOError("Unable to find vcvarsall.bat") into "error: None".

This function should not be used IMO. Its docstring claims that it
"Handles Python 1.5.1 and 1.5.2 styles", but str() does a better job...

Patch attached.
msg101389 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2010-03-20 18:42
Tarek: This patch seems reasonable to me, is this something that can be applied?
msg101390 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-03-20 19:51
I guess i can be applied on distutils, and backported in distutils2. I'll do it in the coming days.

Notice that I am now applying only bug fixes and regression fixes now for distutils.
msg117690 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-30 01:49
I will commit this if Tarek does not do it shortly.

In distutils2, I’ll remove grok_environment_error wholly, since it exists for 1.5 compat only.
msg120588 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-06 06:42
Giampaolo, can you test Amaury’s patch?  I’d prefer some testing before committing.
msg120611 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) (Python committer) Date: 2010-11-06 12:12
I don't have the same setup I had at the time when I submitted the first message so maybe something has changed in meantime.
Below is what I get on Windows 2000 SP-3, no VS installed, python 2.7, before and after the patch.

C:\Documents and Settings\foo\Desktop\psutil>setup.py build
running build
running build_py
copying psutil\compat.py -> build\lib.win32-2.7\psutil
copying psutil\error.py -> build\lib.win32-2.7\psutil
copying psutil\_psbsd.py -> build\lib.win32-2.7\psutil
copying psutil\_pslinux.py -> build\lib.win32-2.7\psutil
copying psutil\_psmswindows.py -> build\lib.win32-2.7\psutil
copying psutil\_psosx.py -> build\lib.win32-2.7\psutil
copying psutil\_psposix.py -> build\lib.win32-2.7\psutil
copying psutil\__init__.py -> build\lib.win32-2.7\psutil
running build_ext
building '_psutil_mswindows' extension
error: Unable to find vcvarsall.bat


Although the message is improved ("Unable to find vcvarsall.bat" vs "None") it seems the patch had no effect.
History
Date User Action Args
2010-11-06 12:12:51giampaolo.rodolasetmessages: + msg120611
2010-11-06 06:42:22eric.araujosetmessages: + msg120588
2010-09-30 01:49:58eric.araujosetversions: + 3rd party, Python 3.2, - Python 2.6, Python 3.0
messages: + msg117690

assignee: tarek -> eric.araujo
keywords: - needs review
type: behavior
stage: patch review
2010-05-16 18:12:32eric.araujosetnosy: + eric.araujo
2010-03-20 19:51:41tareksetnosy: loewis, jafo, amaury.forgeotdarc, giampaolo.rodola, tarek
messages: + msg101390
resolution: accepted
components: + Distutils2
2010-03-20 18:42:37jafosetpriority: normal
nosy: + jafo
messages: + msg101389

2009-02-06 01:28:03tareksetassignee: tarek
nosy: + tarek
2009-01-14 10:25:24amaury.forgeotdarcsetkeywords: + needs review, patch
nosy: + amaury.forgeotdarc
messages: + msg79845
files: + distutils_ioerror.patch
2009-01-13 18:57:52giampaolo.rodolasetmessages: + msg79769
2009-01-13 18:52:00loewissetnosy: + loewis
messages: + msg79767
2009-01-13 17:31:05giampaolo.rodolacreate