File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -346,6 +346,46 @@ def setup_python(
346
346
setup_setuptools_cross_compile (tmp , python_configuration , python_libs_base , env )
347
347
setup_rust_cross_compile (tmp , python_configuration , python_libs_base , env )
348
348
349
+ if implementation_id .startswith ("gp" ):
350
+ # GraalPy fails to discover compilers, setup the relevant environment
351
+ # variables. Adapted from
352
+ # https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt
353
+ vcpath = subprocess .check_output (
354
+ [
355
+ Path (os .environ ["PROGRAMFILES(X86)" ])
356
+ / "Microsoft Visual Studio"
357
+ / "Installer"
358
+ / "vswhere.exe" ,
359
+ "-products" ,
360
+ "*" ,
361
+ "-latest" ,
362
+ "-property" ,
363
+ "installationPath" ,
364
+ ],
365
+ text = True ,
366
+ ).strip ()
367
+ log .notice (f"Discovering Visual Studio for GraalPy at { vcpath } " )
368
+ vcenv = dict (
369
+ [
370
+ envvar .strip ().split ("=" , 1 )
371
+ for envvar in subprocess .check_output (
372
+ [
373
+ f"{ vcpath } \\ Common7\\ Tools\\ vsdevcmd.bat" ,
374
+ "-no_logo" ,
375
+ "-arch=amd64" ,
376
+ "-host_arch=amd64" ,
377
+ "&&" ,
378
+ "set" ,
379
+ ],
380
+ shell = True ,
381
+ text = True ,
382
+ )
383
+ .strip ()
384
+ .split ("\n " )
385
+ ]
386
+ )
387
+ env .update (vcenv )
388
+
349
389
return base_python , env
350
390
351
391
You can’t perform that action at this time.
0 commit comments