您的位置:首页 > 编程语言 > Python开发

VS2005使用distutils模块自动编译python扩展模块

2006-05-15 09:40 786 查看
应该修改msvccompiler.py,使得兼容vs2005:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1425482&group_id=5470

--- msvccompiler_ori.py Sun Aug 7 17:50:38 2005
+++ msvccompiler_mod.py Mon Feb 6 13:10:40 2006
@@ -126,7 +126,10 @@
self.set_macro("FrameworkDir", net, "installroot")
try:
if version > 7.0:
- self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
+ try:
+ self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
+ except KeyError:
+ self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv2.0")
else:
self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
except KeyError, exc: #
@@ -552,10 +555,24 @@
Return a list of strings. The list will be empty if unable to
access the registry or appropriate registry keys not found.
"""
-
if not _can_read_reg:
return []

+ if self.__version >= 8:
+
+ # With .NET 8.0, the environment variables are not stored in the
+ # registry anymore. They are stored in a platform specific file
+ # under C:/Program Files/Microsoft Visual Studio 8/VC/vcpackages/
+ # Instead of parsing these files (which I don't know how to do),
+ # we simply rely on the fact that the python script is being
+ # called from a "Visual Studio 2005 Command Prompt". In these
+ # consoles, the environment variables are properly defined.
+
+ real_path = path
+ if path == "library":
+ real_path = "lib";
+ return string.split(os.environ[real_path], ";")
+
path = path + " dirs"
if self.__version >= 7:
key = (r"%s/%0.1f/VC/VC_OBJECTS_PLATFORM_INFO/Win32/Directories"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: