MCPcopy Index your code
hub / github.com/python/cpython / load_macros

Method load_macros

Tools/c-analyzer/distutils/msvccompiler.py:110–136  ·  view source on GitHub ↗
(self, version)

Source from the content-addressed store, hash-verified

108 break
109
110 def load_macros(self, version):
111 vsbase = r"Software\Microsoft\VisualStudio\%0.1f" % version
112 self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir")
113 self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir")
114 net = r"Software\Microsoft\.NETFramework"
115 self.set_macro("FrameworkDir", net, "installroot")
116 try:
117 if version > 7.0:
118 self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
119 else:
120 self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
121 except KeyError as exc: #
122 raise DistutilsPlatformError(
123 """Python was built with Visual Studio 2003;
124extensions must be built with a compiler than can generate compatible binaries.
125Visual Studio 2003 was not found on this system. If you have Cygwin installed,
126you can try compiling with MingW32, by passing "-c mingw32" to setup.py.""")
127
128 p = r"Software\Microsoft\NET Framework Setup\Product"
129 for base in HKEYS:
130 try:
131 h = RegOpenKeyEx(base, p)
132 except RegError:
133 continue
134 key = RegEnumKey(h, 0)
135 d = read_values(base, r"%s\%s" % (p, key))
136 self.macros["$(FrameworkVersion)"] = d["version"]
137
138 def sub(self, s):
139 for k, v in self.macros.items():

Callers 1

__init__Method · 0.95

Calls 3

set_macroMethod · 0.95
read_valuesFunction · 0.85

Tested by

no test coverage detected