Compiling Python 2.4 extensions with free VC++ Toolkit

J

Jody Burns

Hi all,

I've been wondering if there's anything on the drawing board about
patching distutils/msvccompiler.py so that it can compile Python
extensions using the free Visual C++ toolkit instead of the entire
Visual C++ development environment.

I know it's possible, because I was able to compile and install PyCrypto
2.0 for Python 2.4 today. I did this by commenting out the part of
msvccompiler that checks for VS library paths and manually adding them
to my LIB environment variable.

I looked through the CVS and couldn't find anything about this, although
msvccompiler.py has been patched to give a better error message about
requiring the .NET framework if you have don't have it installed.

Your thoughts?

--Jody
 
M

Mike C. Fletcher

Hi all,

I've been wondering if there's anything on the drawing board about
patching distutils/msvccompiler.py so that it can compile Python
extensions using the free Visual C++ toolkit instead of the entire
Visual C++ development environment.

I've got a patch for msvccompiler.py as part of my Toolkit recipe here:
http://www.vrplumber.com/programming/mstoolkit/
it seems to work fairly well for those who have tried it, and should
allow MSVC 7.1 to override MSToolkit if it's installed... i.e. it should
work on non-toolkit installs as well (don't have MSVC 7.1 to test that,
but the changes shouldn't alter "normal" usage).
I know it's possible, because I was able to compile and install
PyCrypto 2.0 for Python 2.4 today. I did this by commenting out the
part of msvccompiler that checks for VS library paths and manually
adding them to my LIB environment variable.

If you feel like it, try with the patch/recipe above. It should avoid
any extra work regarding fiddling with paths on a per-package basis
(though that's just because it puts the path setup into the vc7.bat file
and then tells distutils to look in the environment for them).

Have fun,
Mike

BTW, what is with that funky 7-person garbage "From:" list in your
message header? Some messed-up attempt at spam-catching? Rather
annoying in Thunderbird, as it generates 7 garbage "To" headers when
doing a reply-to-all to catch the mailing-list. Might want to fix that...

________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
 
P

Peter Hansen

Jody said:
I've been wondering if there's anything on the drawing board about
patching distutils/msvccompiler.py so that it can compile Python
extensions using the free Visual C++ toolkit instead of the entire
Visual C++ development environment.

I know it's possible, because I was able to compile and install PyCrypto
2.0 for Python 2.4 today. I did this by commenting out the part of
msvccompiler that checks for VS library paths and manually adding them
to my LIB environment variable.

I looked through the CVS and couldn't find anything about this, although
msvccompiler.py has been patched to give a better error message about
requiring the .NET framework if you have don't have it installed.

Your thoughts?

None, other than to note that if you and/or others were able to
solve this and make it "easy" for those less VC++-savvy, you
might significantly decrease the bar for those of us who have
not been able to get into hacking on the core of Python because
of being stuck in the MS world yet not willing to shell out more
cash to billg... maybe, just maybe, that would get a few more
people out there reviewing patches and maybe fixing bugs.

-Peter
 
J

Jody Burns

Cool! I wasn't aware of your recipe. I just tried it and it works
perfectly. You should submit it, it's great! BTW, you can add PyCrypto
to your list of working modules ;) Thanks!

Also, I don't know what was going on with my From: headers before; I
took out the spam-proofing. I'm using Thunderbird 1.0.

--Jody
 
M

Mike C. Fletcher

Jody Burns wrote (with Peter):
See Mike C. Fletcher's post and
http://www.vrplumber.com/programming/mstoolkit/ for a way to do it
very easily (you have to be able to use the GNU patch tool, but that's
not difficult at all).

--Jody
....

....
Keep in mind that the recipe there is for building *extensions*, not
core Python. There's a pointer from my page to a post by someone who
seemed to have built core Python with the Toolkit, but my page isn't
going to help Peter much with hacking on core Python.

Just an FYI,
Mike

________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
 
J

Jody Burns

My bad, I misread his post. I don't know how to compile Python without
Visual Studio.

--Jody
 
J

Jody Burns

My bad, I misread his post. I don't know how to compile Python without
Visual Studio.

--Jody
 
G

Grumman

Jody said:
Hi all,

I've been wondering if there's anything on the drawing board about
patching distutils/msvccompiler.py so that it can compile Python
extensions using the free Visual C++ toolkit instead of the entire
Visual C++ development environment.

I know it's possible, because I was able to compile and install PyCrypto
2.0 for Python 2.4 today. I did this by commenting out the part of
msvccompiler that checks for VS library paths and manually adding them
to my LIB environment variable.

Been messing around with that myself earlier today.

I just added the registry keys that msvccompiler.py was looking for. And
pointed them to the toolkit and sdk paths. Worked just fine.

It worked to build PIL 1.1.4 for python 2.4 today, although without
freetype2 support. Probably just needs some minor tweaking to get it in
there as well.

I'll have to grab the source of some other extensions, and see how they
turn out as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top