distutils problem windows xp python 2.4.2
ajikoe at gmail.com
ajikoe at gmail.com
Mon Dec 5 10:34:05 EST 2005
Hello,
It give the same error result:
D:\testprogram\distutils problem>setup build
running build
running build_ext
*** Failed: error: The .NET Framework SDK needs to be installed before
building extensions for Python.
Attempting to patch distutils.msvccompiler and retry:
running build
running build_ext
*** Failed: error: The .NET Framework SDK needs to be installed before
building extensions for Python.
Attempting to patch distutils.msvccompiler and retry:
This is inside my setup.py
#from distutils.core import setup, Extension
#
#module = Extension('pr', sources = ['prmodule.c'])
#setup(name = 'Pr test', version = '1.0', ext_modules = [module])
#
__version__ = '0.3'
from distutils.core import setup, Extension
for attempts in range(2):
try:
setup(name='Pr test', version='1.0',
ext_modules=[Extension('pr', ['prmodule.c'])])
except SystemExit, e:
print '*** Failed:', e.args[0]
else:
break # Successful (avoid the retry)
print 'Attempting to patch distutils.msvccompiler and retry:'
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:\Program Files\Microsoft Visual Studio
8\VC\bin\vcvars32.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.
Yours,
pujo
More information about the Python-list
mailing list