I managed to do it with the instructions at
http://www.vrplumber.com/programming/mstoolkit/
-- Gerhard
http://www.vrplumber.com/programming/mstoolkit
and say thanks to Mike Farmer.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
You need the Microsoft .NET Visual Studio environment. A stripped and free
version is available at http://msdn.microsoft.com/visualc/vctoolkit2003/
However I am not sure if everything will work with this stripped version.
Peter
That's Mike Fletcher [sorry, Mike].
I just got the following to work for me, maybe it will work for you.
I had some hassles with trying to get the patches to work and wanted a
technique which did not involve messing with the distribution.
It has the advantage of not actually writing into the main Python files.
You still need the free tools Mr. Fletcher links to, and a copy of
the "v7.bat" file that he talks about making (here I show it as in
C:/bin/v7.bat).
Here's an example setup:
__version__ = '0.3'
from distutils.core import setup, Extension
for attempts in range(2):
try:
setup(name='simple', version='0.9',
ext_modules=[Extension('simple', ['simple.c'])])
except SystemExit, e:
print '*** Failed:', e.args[0]
else:
break # Successful (avoid the retry)
print 'Attempting to patch distutils.msvccompiler and retry:'
<<patching code>>
=============
Patching code can either be a (properly indented) literal copy of the
following code, or you can simply write the following into a file
named "patch_msvc.py" and use "import patch_msvc" for patching code.
import distutils.msvccompiler
class BatReader(object):
def __init__(self, batch_filename):
self.source = open(batch_filename, 'rU')
def getsets(self):
'''Get all command lines which are "SET" commands.'''
self.source.seek(0)
for line in self.source:
try: command, rest = line.split(None, 1)
except ValueError: continue # Set a=b splits fine
if command.lower() == 'set':
try: key, value = rest.split('=', 1)
except ValueError: continue # breaking a=b;c;d
elif command.lower() == 'path':
key, value = command, rest #path x == set path=x
yield key, value.rstrip()
def paths(self, pathkey):
'''Find the file paths using our getsets methods.'''
keyed = pathkey.upper()
for key, paths in self.getsets():
if key.upper() == keyed:
elements = paths.split(';')
if elements[-1].upper() == keyed.join('%%'):
return elements[: -1]
return elements
class MSVCCompiler(distutils.msvccompiler.MSVCCompiler):
_patho = BatReader(r'C:\bin\vc7.bat') # or vcvars32.bat or ...
def get_msvc_paths(self, path, platform='x86'):
if path == 'library': path = 'lib'
return self._patho.paths(path)
distutils.msvccompiler.MSVCCompiler = MSVCCompiler
# OK, patched it, now go try again.
--
-Scott David Daniels
scott....@acm.org