classification
Title: Support Visual Studio 2010
Type: enhancement Stage: commit review
Components: Build, Windows Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brian.curtin Nosy List: alexis, brian.curtin, eric.araujo, jackjansen, jason.coombs, kristjan.jonsson, loewis, mark.dickinson, mhammond, prlw1, python-dev, sable, santa4nt, sbt, tarek, tim.golden
Priority: normal Keywords: needs review, patch

Created on 2011-10-18 12:55 by sable, last changed 2012-08-20 14:56 by prlw1. This issue is now closed.

Files
File name Uploaded Description Edit
sxs.patch kristjan.jonsson, 2012-03-23 13:18 Disable SxS assemblies when needed. review
errnomodule.diff kristjan.jonsson, 2012-03-23 13:27 review
pcbuild10.patch kristjan.jonsson, 2012-03-23 14:33 review
wsa_undef.patch sbt, 2012-04-27 11:12 review
code_changes.diff brian.curtin, 2012-05-02 03:58 review
code_changes2.diff brian.curtin, 2012-05-09 02:56 review
pcbuildpatch.patch kristjan.jonsson, 2012-05-14 18:37 review
pcbuildpatch.patch kristjan.jonsson, 2012-05-19 11:03 review
Messages (83)
msg145803 - (view) Author: Sébastien Sablé (sable) Date: 2011-10-18 12:55
Python for Windows is currently compiled with Visual Studio 2008.
It is not possible to use Visual Studio 2010.

It would be great to be able to compile Python with Visual Studio 2010:

* some people may only have access to this compiler which is more recent

* when embedding Python in an application compiled with Visual Studio 2010, you mix 2 C Runtime Libraries (msvcr90.dll and msvcr100.dll) which will generally result in a crash

This is the parent issue. I have various patches to achieve that and I will try to open one issue by patch. I may also run a builtbot using that compiler.
msg145810 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011-10-18 13:43
We can make Python compile with Visual Studio 2010, but it will not be the platform Python is released on, it would be optional while 2008 stays the release target, at least through Python 3.3. In Python 3.4, we may re-evaluate this, and it's likely we would jump over 2010 and move to Visual Studio 2012 at that point (per discussions on python-dev).

As for your first point, Visual Studio 2008 is still available on the Microsoft site, it's just not the first thing you usually find. If you look here - http://msdn.microsoft.com/en-us/express/future/bb421473 - you can find it.


Anyway, I've done this port internally at my company, but I'm not able to release that patch. I am, however, willing to do it personally so it could be included here. If anyone else is interested in working on it, it should follow the same format as other VS version support, going in the PC/VS{version} folder.

Also, reclassified this to the proper version, 3.3, since it's a feature request.
msg145812 - (view) Author: Sébastien Sablé (sable) Date: 2011-10-18 14:24
Here is a quick and dirty draft of the modifications I had to do in order to get Python 2.7.2 to compile with VS2010 on the wiki:

http://wiki.python.org/moin/VS2010

I will improve/complete it as I progress.
I will also do a 64 bits version.
msg145820 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-18 15:57
The wiki page contains change to distutils, which I believe would not be allowed by the feature freeze.  New features (such as support for a new compiler) need to target packaging.
msg145846 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2011-10-18 17:50
I think this issue urgently needs a scope defined. What *exactly* is it that you want to achieve? If it's merely being able to compile Python with VS 2010, many of the proposed changes are unnecessary.

If you propose that the patch should be used to replace VS 2008 with VS 2010, I suggest that instead of developing it as a patch, you create a hg clone that you maintain on your own.

If you propose that Python 3.3 be built and released with VS 2010, then we need to re-evaluate this question again. Wrt. VS 2012, my hope is that this will be available for 3.3 already. If that's not going to happen, I'd be open to switch to 2010 for 3.3 only (and to 2012 for 3.4).
msg145890 - (view) Author: Sébastien Sablé (sable) Date: 2011-10-19 07:51
Martin, what I want to achieve is to ensure that someone can download Python sources and compile them without any modification using a standard install of Windows + Visual Studio 2010 SP1.

I don't really care what is the default compiler used to generate the official binaries, this is a decision that should be taken according to what most people use. But a least the compilation should work easily with the recent and popular VS2010 compiler.

As I said the patch is for the moment a quick and dirty draft: it breaks compilation with VS2008 and assume VS2010. Of course this is not my goal: the final patch should work with existing compilers as well as VS2010.

Which part of the changes do you consider unnecessary?

Concerning the target version: I need to use Python 2.7 internally because our application has not been migrated to Python 3.
I think other people may be in the same case.

I understand there is a feature freeze on this branch (event though the changes in this case are well localized and not intrusive), so I will target primarily Python trunk for the inclusion of patches, but I will also maintain internally my own set of patches for Python 2.7 (and in the wiki for those who are interested).
msg145892 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2011-10-19 08:00
> Which part of the changes do you consider unnecessary?

All the parts dealing with packaging, in particular Tools/msi.

> I understand there is a feature freeze on this branch (event though
> the changes in this case are well localized and not intrusive), so I
> will target primarily Python trunk for the inclusion of patches, but
> I will also maintain internally my own set of patches for Python 2.7
> (and in the wiki for those who are interested).

Instead of doing so internally, I really suggest to maintain a public
hg clone, either on hg.python.org (by your name), or on, say, bitbucket.
msg145893 - (view) Author: Sébastien Sablé (sable) Date: 2011-10-19 08:09
Packaging makes it easier to distribute Python among my colleagues and customers, so I think it is a nice addition.

OK for the hg clone, I will set up that (I actually already use mercurial internally to handle those modifications).
msg147893 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011-11-18 16:40
I mentioned this on another issue, but I created a clone at http://hg.python.org/sandbox/vs2010port/. I've already gone through the port in the past but wasn't able to release the code at the time. As I work through it, I'll occasionally announce large milestones here.
msg147894 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2011-11-18 16:41
Thanks. I was going to ask about this to see if anyone had already done 
the legwork.
msg148321 - (view) Author: Sébastien Sablé (sable) Date: 2011-11-25 15:16
I don't have commit access on hg.python.org, so I also created a clone on bitbucket at:
https://bitbucket.org/sablefr/py27vs2010/overview

I work with a patch queue for the moment since everything is not completely settled yet.

The patch are against python 2.7 for the moment, I will do the same for python trunk soon.
I can run all the tests with builbot and I am working on reducing the errors.

Currently I am at:
337 tests OK.
5 tests failed:
    test_anydbm test_pep277 test_shelve test_subprocess test_trace
1 test altered the execution environment:
    test_distutils
45 tests skipped:
    test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl
    test_commands test_crypt test_curses test_dbm test_dl test_epoll
    test_fcntl test_fork1 test_gdb test_gdbm test_gl test_grp
    test_imgfile test_ioctl test_kqueue test_linuxaudiodev test_macos
    test_macostools test_mhlib test_nis test_openpty test_ossaudiodev
    test_pipes test_poll test_posix test_pty test_pwd test_readline
    test_resource test_scriptpackages test_sunaudiodev test_tcl
    test_threadsignals test_tk test_ttk_guionly test_ttk_textonly
    test_wait3 test_wait4 test_zipfile64
6 skips unexpected on win32:
    test_gdb test_readline test_tcl test_tk test_ttk_guionly
    test_ttk_textonly
msg148322 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011-11-25 15:20
Just to be sure in case you didn't know, but patches against 2.7 for this issue won't be accepted.
msg148325 - (view) Author: Sébastien Sablé (sable) Date: 2011-11-25 15:33
Yes I know, but this is my primary target as this is the version that I use in my product for the moment.

I will test python trunk soon now that Python 2.7 with VS2010 is in a rather good shape.
msg148326 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-25 15:34
Just to avoid misunderstandings: The Subversion concept of trunk (or rather py3k trunk) maps to the Mercurial branch named default, which is what you get when you clone hg.python.org/cpython.  This is 3.3.
msg148331 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011-11-25 16:20
Before we both go down the same paths and duplicate effort, http://hg.python.org/sandbox/vs2010port/ has already completed the transition in terms of running the conversion, saving off the VS9 files, making some minimal code changes (errno module specifically), and has begun to fix tests. This is already done for 'default' aka 3.3.

8 tests failed:
    test_distutils test_email test_io test_os test_packaging
    test_pep3151 test_socket test_subprocess

The distutils and packaging test failures seem to be about differences in command line flags for some of the VS2010 binaries (looks like a link.exe issue in one). Most of the others are about remaining errno differences, and the subprocess issue is with too many files being open.
msg148488 - (view) Author: Sébastien Sablé (sable) Date: 2011-11-28 15:22
OK Brian, I checked your clone and I will keep an eye on it.

I have done almost the same thing for the moment. My patch queue includes some additional corrections for a few more bugs that prevented me from completely running the test suite (crash dumps).

I will start working on Python 'default' probably tomorrow.
msg148490 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011-11-28 15:36
If you want to clone from that repo, use the "vs2010" branch.

hg clone http://hg.python.org/sandbox/vs2010port/
hg up vs2010

From there, you can post patches here that I can integrate for you.
msg148493 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-28 15:44
A tip to make Mercurial download only a subset of all the changesets in the repo:

  hg clone URI -r branch

or

  hg clone URI#branch

(The difference is that in the second form, URI#branch will be recorded in the .hg/hgrc file and subsequent pulls will only pull from that branch.)

bandwith-is-a-scarce-resource’ly yours
msg148664 - (view) Author: Sébastien Sablé (sable) Date: 2011-11-30 15:25
I have started working on python default branch.
My patch queue is available here:
https://bitbucket.org/sablefr/py3kvs2010/

The result is the following so far:
323 tests OK.
8 tests failed:
    test_distutils test_fileio test_gettext test_io test_os
    test_packaging test_pep3151 test_support
4 tests altered the execution environment:
    test_multiprocessing test_site test_subprocess test_sysconfig
27 tests skipped:
    test_crypt test_curses test_dbm_gnu test_dbm_ndbm test_devpoll
    test_epoll test_fcntl test_fork1 test_gdb test_grp test_ioctl
    test_kqueue test_nis test_openpty test_ossaudiodev test_pipes
    test_poll test_posix test_pty test_pwd test_readline test_resource
    test_syslog test_threadsignals test_wait3 test_wait4
    test_zipfile64
2 skips unexpected on win32:
    test_gdb test_readline

Most errors seem related to errno.
msg148665 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011-11-30 15:27
Again, rather than work off of the default branch and duplicate effort, can you work off of the vs2010 branch on http://hg.python.org/sandbox/vs2010port/?
msg156146 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-03-17 09:51
I'd like to subscribe to this newsletter.
IMHO, it is important that people are able to compile python with VS2010 with minimum fuss.  Not everyone has access to older compilers and forward compatibility shouldn't be that hard.  
There are to problems currently, as far as I can tell:
1) errnomodule.c needs to be changed to make sure WSAERROR and ERROR are the same.  A patch to this effect exists already.
2) the .vcproj files don't upgrade correctly.  The new ones have an extra "TargetName" property, optionally settable but defaults to ProjectName.  This causes linker errors because of python's peculiar _d extension for debug.  There is no easy fix for this so a solution would be, unfortunately, to maintain a separate PCBuild10 directory.

What is there keeping this from moving forwards?
msg156150 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-17 10:13
> IMHO, it is important that people are able to compile python with
> VS2010 with minimum fuss.  Not everyone has access to older compilers
> and forward compatibility shouldn't be that hard.

Not sure what you mean by "forward compatibility". You cannot build
extension modules with a different version of MSVC than you built
Python with; that's inherent in the way the MS CRT works. This means
that Python 2.7 and 3.2 will continue to use VS 2008 until their
end-of-life, and extensions module authors will continue to need
VS 2008. Getting the old compilers isn't that hard, either - the
express edition of VS 2008 is still available for download.

So whatever "forward compatibiltiy" is in this context - I think
it is extremely hard.

> What is there keeping this from moving forwards?

Brian Curtin has volunteered to work on this. Maybe he can comment
on the status; there is little point in people duplicating efforts
(except perhaps for publishing hg clones that add project files
for the older branches, for people who want that).
msg156178 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-03-17 17:13
Nothing's keeping it from moving forward at this point. Progress stagnated the last few months because I was busy doing organizational and PR work for PyCon. Now that the conference has passed, this and installer changes are on the top of my list. I will follow up with the current state of the port within the next few days (I should have time tomorrow evening).
msg156322 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-03-19 08:43
Super Brian, let me know if I can help.
I already did the necessary changes locally.

Martin, what I mean by "forward compatibility" is simply that the source code compiles and works with more recent versions of the compiler.  The assumption in "errnomodule.c" that e.g. WSAEAGAIN and EAGAIN are defined to the same value prevent that.  Just this little fix would fix almost everything.

I'm sure that a lot of people hacking on python compile it locally without expecting it to work out of the box with downloaded extension modules.  

FYI, Eve Online has been running with VS2010 compiled python 2.7 since the middle of last year :)
msg156658 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-03-23 13:18
Adding a patch to disable Side by Side assemblies in VS2010 (MS saw the light)
msg156659 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-03-23 13:27
Here is a comprehensive patch to errnomodule.c, as used in production at CCP
msg156663 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-03-23 14:33
Adding a patch containing a proposed PCBuild10 folder.
This consists of:
1) automatically updated .vcxproj and .sol files, provessed by 3) below
2) manually edited and new .props files to edit TargetName and Extension attributes
3) a vs9to10.py file to additionally process autoconverted .vcxproj files
4) edited .txt and .bat files.

Please notice how I have removed a lot of redundant settings from .vcxproj files and moved them to .props files.

This is proposed as a new top level directory, similar to what PCBuild9 used to be.  Putting stuff inside PC/VS10.0 would require a much more intensive surgery of relative paths and things.  Not very nice.
msg157214 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-31 17:38
The errnomodule patch shouldn't be checked in as is. Instead, an elaborate comment needs to be added fully explaining the situation with the errno codes, and giving criteria under which cases it is necessary.

On the face value, it's incorrect: if the compiler defines EINVAL, that should be what is used to define errno.EINVAL. It's not at all clear that WSAEINVAL is a better choice.
msg157218 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-03-31 18:30
Why should python compiled with VS2010 have different error codes than one compiled with the older compilers?  We could revisit this in a new python version, but for now, we should maintain compatibility across compilers.

the errno codes (EAGAIN etc) are provided only as a compatibility for posix apps that test "errno".  On windows, we use the WSA return values from the api functions and WsaGetLastError().

The reason this patch is required is that now, the errno constants get pulled in with the WSA ones, and therefore the conditional compilation in errnomodule.c gets mangled.  So, the proposed patch is not a change, it is merely reinforcing the previous practice of prefering the native error codes over the 'errno' emulation.  Of course, this should be clarified in a comment, as you point out.
msg159373 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-04-26 15:04
> the errno codes (EAGAIN etc) are provided only as a compatibility for 
> posix apps that test "errno".  On windows, we use the WSA return values 
> from the api functions and WsaGetLastError().
> ...
> So, the proposed patch is not a change, it is merely reinforcing the 
> previous practice of prefering the native error codes over the 'errno' 
> emulation.

Except that Microsoft's C library also uses some of the non-WSA versions.  For instance read() (or _read()) is documented to set errno to EBADF or EINVAL on error.  So EBADF and EINVAL are just as "native" as WSAEBADF and WSAEINVAL.

It is also quite common for python's C code to do stuff like

    errno = EINVAL;
    PyErr_SetFromErrno(PyExc_OSError);

errnomap in Objects/exceptions.c is used to convert some OSError exceptions to subclasses like PermissionError.  It shouldn't be hard to use it to also convert WSAEINVAL to EINVAL etc.
msg159375 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-26 15:09
I recently added what you just mentioned in the vs2010port branch for WSA and non-WSA to work together. I still need to figure out some distutils/packaging failures, but the port is nearly ready*.

* I've only focused on 32-bit debug builds, but updating the project files and whatnot for other configurations is easy.
msg159378 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-04-26 15:19
> Except that Microsoft's C library also uses some of the non-WSA
> versions.  For instance read() (or _read()) is documented to set
> errno to EBADF or EINVAL on error.  So EBADF and EINVAL are just as
> "native" as WSAEBADF and WSAEINVAL.
read() is a posix function, so of course they set errno for it.  You'll probably find that GetLastError() will some native error codes.


> It is also quite common for python's C code to do stuff like
>    errno = EINVAL;
>    PyErr_SetFromErrno(PyExc_OSError);
This doesn't change that, and as far as I know, this has worked and continues to work.  "errno" is supported.

> errnomap in Objects/exceptions.c is used to convert some OSError
> exceptions to subclasses like PermissionError.  It shouldn't be hard
> to use it to also convert WSAEINVAL to EINVAL etc.
Why would we get different errors codes for e.g. connection reset events because we build with a different compiler?
Python has always used the native error codes for socket io on windows, why change that?
msg159379 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-04-26 15:20
Brian, I posted a suggested port five weeks ago.  What kind of problems are you having?  It's really a very straightforward thing.
msg159380 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-04-26 15:22
Also, I'm not sure distutils and all that is really necessary.  As I understood it, the goal is to make it so that the casual hacker can compile and run python using visual studio 2010.  3.3 continues to be "officially" distributed with 2008.  Surely it is possible to do this in smaller steps, rather than one fell swoop?
For instance, the sxs patch and the errnomodule patch could go in now without disturbing anything whatsoever.
msg159383 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-26 15:31
No, this is the real thing. Python 3.3 distributed on VS2010.

In order to ship a fully built Python 3.3 MSI for users, I've found it's not just as easy as updating errno. I'll strip out all of the project file changes and whatnot and post a patch of the actual C and Python code changes to see that this is in line with what people think is usable.
msg159385 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-26 15:32
Also, I personally don't care about distutils, but I need all of the tests to pass before I can consider merging this. Distutils and packaging need a few changes to be able to compile extensions and create setups and whatever with VS2010.
msg159386 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-04-26 15:40
Could you attach a file with the distutils/packaging test output?  I don’t really know the packaging.compiler module, but I may be able to make sense of the error messages and work with you to fix them.
msg159392 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-04-26 16:14
> This doesn't change that, and as far as I know, this has worked and 
> continues to work.  "errno" is supported.

Using your patch, does the following throw an AssertionError?

>>> import os, errno
>>> try:
...   os.read(-1, 10)
... except OSError as e:
...   assert e.errno == errno.EBADF
...
>>>
msg159400 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-04-26 17:28
> Using your patch, does the following throw an AssertionError?
Yes, it looks as though it will.  It seems I was too agressive, since errnomodule has different entries for EBADF and WSAEBADF.

This is the kind of feedback I'd like to have had earlier. It means that there are some cases were we want to keep the winsock error codes there separately from the others.  Annoying as that may be.

Brian, do I understand you correctly that 2010 is to the official compiler for 3.3?
msg159401 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-26 17:30
Yes.
msg159402 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-04-26 17:34
Super, I must have missed that memo.  At PyCon there wasn't much enthusiasm for it, and this was considered a toy project :)

You may be interested in my patch to see what I did with the project files, then.  Otherwise, I'll be happy to review yours.  In particular, I removed a bunch of redundant settings, and fixed the .props files.
msg159412 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-04-26 18:56
> For instance, the sxs patch and the errnomodule patch could go in now
> without disturbing anything whatsoever.

I'm not convinced that the errno change is actually correct.
msg159413 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-04-26 18:58
> Brian, do I understand you correctly that 2010 is to the official compiler for 3.3?

Unless we switch to VS 2012, yes.
msg159414 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-26 19:00
I don't have a link handy, but from what I've read we could go from VS2010 to VS2012 with relative ease since it's supposed to be able to work with 2010 solutions/project files. I haven't tried this with the beta, but I'll take a look.
msg159420 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-04-26 19:51
VS11 opened the VS2010 project fine without doing conversion. Note that this just uses VS11 to work with the project in VS2010 mode with the 2010 compiler.

Doing the conversion to VS11's compiler is another thing to consider, although probably not until it goes RTM. I just ran the conversion from VS2010 to VS11 and it just sets "PlatformToolset" to "v110" in all vcxproj files. It didn't compile cleanly, having 25 projects succeed and 4 fail, but it was more than enough to get python_d.exe to run. A few tests failed, but they're the same as the failures on VS2010, so we're not far off from VS11 easily working.
msg159424 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-04-26 21:07
MVL wrote:
> I'm not convinced that the errno change is actually correct.

You are right, as SBT pointed out.  There are cases where we have had errno.EFOO and errno.WSAEFOO point to different values, because one was used by sockets and other by regular stuff.  My patch was too heavy handed and nerfed at least EBADF.  Perhaps others.  (Getting a concrete example from SBT was helpful, btw)

For socket-specific errors, it is an easy choice, however, but for socket error codes that also have to do with file IO it is less clear and probably full of special cases.  This is nothing new, however.  For writing portable socket code that needs to deal with the EBADF code, you would have to check for WSAEBADF on windows and EBADF on linux.  Probably both to be portable.

Since my patch was aimed at making 3.3. merely compilable for VS2010 I wanted to maintain the same value semantics as were it compiled for 2008.  If we are changing the compiler version however, we might just as well take the plunge and translate the windows codes where they have corresponding posix codes.  I'm eager to see Brian's patch.
msg159426 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-04-26 21:09
[the Soney PS3 sdk also has weird error codes for its otherwise posix compatible api.  I did write a translation layer to convert those codes into posix codes where appropriate.  I could show you what I did, but I'd proably set me up to be lynched by Soney's lawyers.]
msg159448 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-04-27 11:12
The problems with error numbers seem to be caused by the addition of a new section in errno.h:

/* POSIX SUPPLEMENT */
#define EADDRINUSE      100
#define EADDRNOTAVAIL   101
...
#define ETXTBSY         139
#define EWOULDBLOCK     140

Of these the only ones which clash with WSA equivalents are

EADDRINUSE
EADDRNOTAVAIL
EAFNOSUPPORT
EALREADY
ECONNABORTED
ECONNREFUSED
ECONNRESET
EDESTADDRREQ
EHOSTUNREACH
EINPROGRESS
EISCONN
ELOOP
EMSGSIZE
ENETDOWN
ENETRESET
ENETUNREACH
ENOBUFS
ENOPROTOOPT
ENOTCONN
ENOTSOCK
EOPNOTSUPP
EPROTONOSUPPORT
EPROTOTYPE
ETIMEDOUT
EWOULDBLOCK

I think the simplest solution is just to undefine these new "clashing" constants near the top of Modules/errnomodule.c and Objects/exceptions.c so that we fall back to the preferred WSA equivalents later.

I have tried this by cloning sandbox/vs2010port, reverting 

Objects/exceptions.c
Modules/posixmodule.c
Modules/errnomodule.c
Modules/_io/fileio.c

to "ancestor(vs2010,default)" and then applying the attached patch.  I get four failures:

test_distutils
test_email
test_import
test_packaging

This is an improvement over the tip of vs2010 (2fc5398b3115) where I get two additional failures

test_importlib
test_subprocess
msg159462 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-04-27 14:43
According to http://msdn.microsoft.com/en-us/library/5814770t.aspx the "supported" errno values in VS2010 are

    E2BIG EACCES EAGAIN EBADF ECHILD EDEADLOCK EDOM EEXIST EILSEQ
    EINVAL EMFILE ENOENT ENOEXEC ENOMEM ENOSPC ERANGE EXDEV STRUNCATE

of which the ones with WSA equivalents are

    EACCES EBADF EINVAL EMFILE

The other constants listed in errno.h are for "compatibility with POSIX".

I take this to mean that the only errno values which will be set by libc are on the supported list.  We should not change any of these, but I think we can redefine the others to WSA equivalents without a problem.
msg159773 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-02 03:58
As of a40f47cc7691, Richard's idea is now the implementation, which seems to work well and has simplified the changes quite well. Attached is code_changes.diff which shows all of the necessary code changes as of now.

The test_import failure you were originally seeing has gone away (it was on default as well, I guess it has been fixed). test_email fails on the default branch as well so nothing new there.
msg159782 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-02 10:15
Posted some comments.
Also, I see you didn't remove the old SxS functionality, no longer used by VS2010 (see my sxs.patch)
msg160241 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-09 02:56
The tip of the vs2010 branch now works just as well as default does. There are no outstanding test failures that aren't seen on default -- test_email still fails for some line ending stuff, but that's not relevant here.

Attached is a patch showing just the code changes, including Kristjan's SXS patch, support in Tools\msi\msi.py for VS2010, and a few small distutils and packaging version adjustments to work with VS2010.
msg160243 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-05-09 03:06
Strange that you had to edit packaging.compiler.msvc9compiler but not the same module in distutils.
msg160246 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-09 06:22
I'd say go ahead and apply it. We can deal with any aftermath later (which, by my VS 2008 experience, will well take several years - we still haven't fully recovered from the switch to VS 2008).
msg160261 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-09 08:42
I concur with Martin.  It is much easier to tweak .vcproj and .props files and such after it has been committed, with lesser diffs to worry about.

(A more cautious version of me would have seen this go into a PCBuild10 folder first for a shakedown, with a later rename, but I keep that guy and his fearmongering quiet most of the time.)
msg160520 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-13 16:19
New changeset 38d7d944370e by Brian Curtin in branch 'default':
Fix #13210. Port the Windows build from VS2008 to VS2010.
http://hg.python.org/cpython/rev/38d7d944370e
msg160521 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-13 16:26
What I just pushed has functioning debug and release builds for both 32 and 64 bit, and the tests introduce no new failures.

As noted on python-dev, we may not have build slaves setup for this change yet, so the Windows builds may appear broken.

I'll leave this open a bit until the infrastructure has caught up, and until any documentation is completed, which I may open a separate issue for.
msg160532 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-13 17:32
All the old .vcproj files are still there.  Probably not useful since the .sln file has been upgraded to VisualStudio 2010.
msg160535 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-13 17:40
New changeset 924c178c0d1d by Brian Curtin in branch 'default':
Move out VS9 project files to PC\VS9.0 folder. Fixes #13210
http://hg.python.org/cpython/rev/924c178c0d1d
msg160536 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-13 17:42
Thanks for noticing. I moved them out to PC\VS9.0 rather than outright deleting.
msg160653 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-14 18:37
Here is a patch to the .vcproj files and the .props files, based on my earlier pcbuil10.patch.
Mostly it is about removing redundant settings.  It also adds .props files for the pythoncore solution.

It also updates the readme, the env.bat, and adds the vs9to10.py file.
While the latter may be out of date by now, perhaps at least some vs10to9 file needs to be in place to support the older compiler?
msg160661 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-14 20:27
LGTM. Brian?
msg160667 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-14 20:55
+1 on the patch. It fixes a bunch of things that I entered unnecessarily (like explicit .pyd names to fix the warnings), but after staring at the screen for a long time I couldn't figure out what I was doing wrong to need them for some reason.

I'm not really interested in supporting VS9 or writing a script for it, but if someone who wanted to use it came up with a script I don't see why we couldn't include it.
msg160668 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-14 21:23
Hm, actually, doing a 64-bit debug build fails with that patch. ctypes, _testbuffer, and xxlimited, the projects I originally had trouble with in the settings, don't link properly.
msg160669 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-14 21:24
Correction, both 64-bit debug and release fail.
msg160942 - (view) Author: Jason R. Coombs (jason.coombs) * (Python committer) Date: 2012-05-16 23:55
Kristjan,
 I'm trying to apply your most recent patch, but many of the hunks fail. I tried to find it by time, but failed to do so. Perhaps you know what revision that patch was against? Thanks.
msg160953 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-17 08:31
> Perhaps you know what revision that patch was against?

I wish people would stop using git-style diffs, then the patch would actually say. However, it applied cleanly to tip at the time it was submitted, so you should be able to go by that.
msg160959 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-17 09:53
Hi, I'll see what went wrong, I admit not trying 64 bit before creating the patch.
Martin, I´m using MercurialHQ and exporting a patch.  It is set up to use GIT format diffs, which I think is recommended in the Python developer FAQ.  Is this wrong?  (I'm still a relative Hg newbie)
msg160960 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-17 10:04
> Is this wrong?  (I'm still a relative Hg newbie)

It's an ongoing discussion. Some people favor git diffs because
it supports renaming and binaries, I prefer Mercurial diffs, because
it includes the base revision number against the patch was made.
msg160961 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-17 10:06
That sounds reasonable.  So, can't we come up with a diff that does both?  The base revision sounds like a completely necessary piece of info.
msg160962 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-17 10:15
I wish MS could come up with a property editor that could show you _only_ the properties that are non-default:
1) view all properties
2) view set and inherited non-defaults
3) view properties set here only.

It would make debugging settings _so_ much easier.  I'll suggest that to the VS team, all the good that will do.
msg160963 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-17 10:26
> That sounds reasonable.  So, can't we come up with a diff that does  
> both?  The base revision sounds like a completely necessary piece of  
> info.

I believe there is a bug report against Mercurial to include the base
revision even in git-style diffs, not sure what the status is. git itself
includes the base revision in its diffs; I believe that Mercurial didn't
dare to use the same syntax since the Mercurial hash wouldn't be a valid
git hash.
msg160965 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-17 11:35
This is fun.
the reason why linking is failing for some projects in x64 mode is:
the SolutionDir (or maybe current dir) is implicitly part of the library search path.  Therefore, when looking for python33_d.lib, it will find the one in PCbuild, and look into that, and ignore the one in PCbuidl\amd64.

Some projects have "references" to the pythoncore project.  This is a .NET feature and not really useful for normal projects, but it does put an explicit link referrence to the correct .lib file into the linker's input arguments.  This is why _testcapi works, and not _testbuffer (try diffing the two .vcxproj files).

All of this stems from my patch removing explicit link references to the correct .lib file.  Perhaps I can reintroduce that, but in a .props file.
msg161107 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-19 10:28
Ok, I find no way to override the linker so that it does not search the current directory first.
I think it is best, and probably in the spirit of visual studio, to use the "reference" part of a project to facilitate linking between dependency projects.  it is designed to take the hassle out of libraries and search paths.  I will add references where they are missing.
msg161108 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-19 10:32
> I think it is best, and probably in the spirit of visual studio, to  
> use the "reference" part of a project to facilitate linking between  
> dependency projects.  it is designed to take the hassle out of  
> libraries and search paths.  I will add references where they are  
> missing.

Sounds good to me.
msg161109 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-19 11:03
Here is an updated patch, with proper project references added and some slight cleanup of .props files.
msg161122 - (view) Author: Jason R. Coombs (jason.coombs) * (Python committer) Date: 2012-05-19 14:24
After enabling the eol extension and re-checking out my working copy, I've applied the patch successfully, but after I do so, I get this error when trying to open the solution in VS2010:

"One or more projects in the solution were not loaded correctly"

and

C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore.vcxproj : error  : The imported project "C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore_d.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore.vcxproj
msg161123 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-05-19 14:46
Ah, good, it looks as though a file is missing from the patch.  I'll fix it.
msg161144 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-05-19 17:59
PCbuild/build.bat and Modules/_decimal/tests/runall.bat still use vcbuild instead of msbuild.

It also seems that if an external dependency is unavailable then msbuild can fail to build targets which do not depend on it.  For instance if I rename openssl-1.0.1c to something else, then this causes msbuild to fail without building ctypes.

I don't think vcbuild had this problem.
msg161147 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-19 18:44
I propose that we declare this issue closed, and defer any new issues arising from the switch to VS 2010 in separate issues.

There will surely be many issues over the next weeks and months, and there is little point in tracking this all on this single page.
msg161148 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-19 18:47
So closing this issue. Kristjan, if you want your patch reviewed further and/or approved by Brian, please copy it into a new issue.
msg161162 - (view) Author: Jason R. Coombs (jason.coombs) * (Python committer) Date: 2012-05-19 21:18
I agree. There is already an issue regarding the packaging dependencies. It currently references ctypes, but we can rename it to be more broad.

issue14821
msg161166 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-19 21:35
No broad issues, please. One tracker item, one issue. If something other than _ctypes_test fails to build, it may or may not have the same reason, so caution requires that we assume they are unrelated defects.
History
Date User Action Args
2012-08-20 14:56:37prlw1setnosy: + prlw1
2012-06-11 13:15:18kristjan.jonssonlinkissue10469 superseder
2012-05-19 21:35:39loewissetmessages: + msg161166
2012-05-19 21:31:27loewissetfiles: - smime.p7s
2012-05-19 21:18:11jason.coombssetfiles: + smime.p7s

messages: + msg161162
2012-05-19 18:47:04loewissetstatus: open -> closed

messages: + msg161148
2012-05-19 18:44:51loewissetmessages: + msg161147
2012-05-19 17:59:39sbtsetmessages: + msg161144
2012-05-19 14:46:02kristjan.jonssonsetmessages: + msg161123
2012-05-19 14:24:47jason.coombssetmessages: + msg161122
2012-05-19 11:03:21kristjan.jonssonsetfiles: + pcbuildpatch.patch

messages: + msg161109
2012-05-19 10:32:14loewissetmessages: + msg161108
2012-05-19 10:28:18kristjan.jonssonsetmessages: + msg161107
2012-05-17 11:35:29kristjan.jonssonsetmessages: + msg160965
2012-05-17 10:26:11loewissetmessages: + msg160963
2012-05-17 10:15:29kristjan.jonssonsetmessages: + msg160962
2012-05-17 10:06:39kristjan.jonssonsetmessages: + msg160961
2012-05-17 10:04:47loewissetmessages: + msg160960
2012-05-17 09:53:22kristjan.jonssonsetmessages: + msg160959
2012-05-17 08:31:39loewissetmessages: + msg160953
2012-05-16 23:55:27jason.coombssetnosy: + jason.coombs
messages: + msg160942
2012-05-14 21:24:18brian.curtinsetmessages: + msg160669
2012-05-14 21:23:25brian.curtinsetmessages: + msg160668
2012-05-14 20:55:40brian.curtinsetmessages: + msg160667
2012-05-14 20:27:14loewissetmessages: + msg160661
2012-05-14 18:37:03kristjan.jonssonsetfiles: + pcbuildpatch.patch

messages: + msg160653
2012-05-13 17:42:06brian.curtinsetmessages: + msg160536
2012-05-13 17:40:29python-devsetmessages: + msg160535
2012-05-13 17:32:44kristjan.jonssonsetmessages: + msg160532
2012-05-13 16:26:33brian.curtinsetresolution: fixed
messages: + msg160521
stage: patch review -> commit review
2012-05-13 16:19:44python-devsetnosy: + python-dev
messages: + msg160520
2012-05-09 08:42:06kristjan.jonssonsetmessages: + msg160261
2012-05-09 06:22:28loewissetmessages: + msg160246
2012-05-09 03:06:37eric.araujosetmessages: + msg160243
2012-05-09 02:56:05brian.curtinsetkeywords: + needs review
files: + code_changes2.diff
messages: + msg160241

stage: patch review
2012-05-02 10:15:23kristjan.jonssonsetmessages: + msg159782
2012-05-02 03:58:47brian.curtinsetfiles: + code_changes.diff

messages: + msg159773
2012-04-27 14:43:07sbtsetmessages: + msg159462
2012-04-27 11:12:09sbtsetfiles: + wsa_undef.patch

messages: + msg159448
2012-04-26 21:09:40kristjan.jonssonsetmessages: + msg159426
2012-04-26 21:07:03kristjan.jonssonsetmessages: + msg159424
2012-04-26 20:22:14hayposetnosy: - haypo
2012-04-26 19:51:12brian.curtinsetmessages: + msg159420
2012-04-26 19:00:18brian.curtinsetmessages: + msg159414
2012-04-26 18:58:05loewissetmessages: + msg159413
2012-04-26 18:56:27loewissetmessages: + msg159412
2012-04-26 17:34:36kristjan.jonssonsetmessages: + msg159402
2012-04-26 17:30:13brian.curtinsetmessages: + msg159401
2012-04-26 17:28:54kristjan.jonssonsetmessages: + msg159400
2012-04-26 16:14:46sbtsetmessages: + msg159392
2012-04-26 15:40:44eric.araujosetmessages: + msg159386
2012-04-26 15:32:56brian.curtinsetmessages: + msg159385
2012-04-26 15:31:44brian.curtinsetmessages: + msg159383
2012-04-26 15:22:48kristjan.jonssonsetmessages: + msg159380
2012-04-26 15:20:52kristjan.jonssonsetmessages: + msg159379
2012-04-26 15:19:48kristjan.jonssonsetmessages: + msg159378
2012-04-26 15:09:53brian.curtinsetmessages: + msg159375
2012-04-26 15:04:59sbtsetnosy: + sbt
messages: + msg159373
2012-04-26 11:49:25mark.dickinsonsetnosy: + mark.dickinson
2012-03-31 18:30:42kristjan.jonssonsetmessages: + msg157218
2012-03-31 17:38:06loewissetmessages: + msg157214
2012-03-23 14:33:55kristjan.jonssonsetfiles: + pcbuild10.patch

messages: + msg156663
2012-03-23 13:27:03kristjan.jonssonsetfiles: + errnomodule.diff

messages: + msg156659
2012-03-23 13:19:00kristjan.jonssonsetfiles: + sxs.patch
keywords: + patch
messages: + msg156658
2012-03-19 08:43:59kristjan.jonssonsetmessages: + msg156322
2012-03-17 17:13:56brian.curtinsetmessages: + msg156178
2012-03-17 10:13:43loewissetmessages: + msg156150
2012-03-17 09:51:26kristjan.jonssonsetnosy: + kristjan.jonsson
messages: + msg156146
2012-02-16 15:15:42jackjansensetnosy: + jackjansen
2011-11-30 15:27:03brian.curtinsetmessages: + msg148665
2011-11-30 15:25:40sablesetmessages: + msg148664
2011-11-28 15:44:47eric.araujosetmessages: + msg148493
2011-11-28 15:36:06brian.curtinsetassignee: brian.curtin
messages: + msg148490
2011-11-28 15:22:59sablesetmessages: + msg148488
2011-11-25 16:20:16brian.curtinsetmessages: + msg148331
2011-11-25 15:34:36eric.araujosetmessages: + msg148326
2011-11-25 15:33:05sablesetmessages: + msg148325
2011-11-25 15:20:02brian.curtinsetmessages: + msg148322
2011-11-25 15:16:03sablesetmessages: + msg148321
2011-11-18 16:41:02tim.goldensetnosy: + tim.golden
messages: + msg147894
2011-11-18 16:40:13brian.curtinsetmessages: + msg147893
2011-10-19 08:09:19sablesetmessages: + msg145893
2011-10-19 08:00:03loewissetmessages: + msg145892
2011-10-19 07:51:28sablesetmessages: + msg145890
2011-10-18 17:50:37loewissetmessages: + msg145846
2011-10-18 15:57:23eric.araujosetmessages: + msg145820
2011-10-18 15:55:17santa4ntsetnosy: + santa4nt
2011-10-18 14:24:42sablesetmessages: + msg145812
2011-10-18 13:43:59brian.curtinsetassignee: tarek -> (no value)
messages: + msg145810
components: - Distutils, Installation, Distutils2
versions: + Python 3.3, - Python 2.7, Python 3.2
2011-10-18 13:03:07hayposetnosy: + loewis
2011-10-18 13:02:59hayposetnosy: + brian.curtin
2011-10-18 13:02:37hayposetnosy: + haypo
2011-10-18 12:55:20sablecreate