Skip to content

Commit b2774b1

Browse files
committed
do not search for VS in distutils when already in a VS shell
1 parent 12c0dd7 commit b2774b1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,20 @@ def getArchivableResultsWithLib(self, *args, **kwargs):
132132
yield result
133133
mx_native.DefaultNativeProject.getArchivableResults = getArchivableResultsWithLib
134134

135+
# let's check if VS compilers are on the PATH
136+
if not os.environ.get("LIB"):
137+
mx.log("LIB not in environment, not a VS shell")
138+
elif not os.environ.get("INCLUDE"):
139+
mx.log("INCLUDE not in environment, not a VS shell")
140+
else:
141+
for p in os.environ.get("PATH", "").split(os.pathsep):
142+
if os.path.isfile(os.path.join(os.path.abspath(p), "cl.exe")):
143+
mx.log("LIB and INCLUDE set, cl.exe on PATH, assuming this is a VS shell")
144+
os.environ["DISTUTILS_USE_SDK"] = "1"
145+
break
146+
else:
147+
mx.log("cl.exe not on PATH, not a VS shell")
148+
135149

136150
def _sibling(filename):
137151
return os.path.join(os.path.dirname(__file__), filename)

0 commit comments

Comments
 (0)