@@ -315,6 +315,25 @@ def setup(self):
315
315
"--make=" + self .make_args .command ,
316
316
],
317
317
)
318
+ python_bin = sys .executable
319
+ python_search_path = self .config .dollar_path_with_other_tools
320
+ # Python from a venv cannot be used for QEMU builds, use the base installation instead.
321
+ if sys .prefix != sys .base_prefix :
322
+ python_bin = sys .executable .replace (sys .prefix , sys .base_prefix )
323
+ python_search_path = python_search_path .replace (sys .prefix , sys .base_prefix )
324
+ py3_version = get_program_version (
325
+ Path (python_bin ),
326
+ config = self .config ,
327
+ regex = re .compile (rb"Python\s+(\d+)\.(\d+)\.?(\d+)?" ),
328
+ )
329
+ # QEMU tests are not compatible with 3.12 yet, try to use an older version in that case
330
+ if py3_version >= (3 , 12 , 0 ):
331
+ for minor_version in (11 , 10 , 9 ):
332
+ found = shutil .which (f"python3.{ minor_version } " , path = python_search_path )
333
+ if found :
334
+ python_bin = found
335
+ break
336
+ self .configure_args .append (f"--python={ python_bin } " )
318
337
319
338
if self .config .create_compilation_db :
320
339
self .make_args .set (V = 1 ) # Otherwise bear can't parse the compiler output
@@ -505,25 +524,6 @@ def setup(self):
505
524
# Linux/BSD-user is not supported for CHERI (yet)
506
525
self .configure_args .append ("--disable-bsd-user" )
507
526
self .configure_args .append ("--disable-linux-user" )
508
- python_bin = sys .executable
509
- python_search_path = self .config .dollar_path_with_other_tools
510
- # Python from a venv cannot be used for QEMU builds, use the base installation instead.
511
- if sys .prefix != sys .base_prefix :
512
- python_bin = sys .executable .replace (sys .prefix , sys .base_prefix )
513
- python_search_path = python_search_path .replace (sys .prefix , sys .base_prefix )
514
- py3_version = get_program_version (
515
- Path (python_bin ),
516
- config = self .config ,
517
- regex = re .compile (rb"Python\s+(\d+)\.(\d+)\.?(\d+)?" ),
518
- )
519
- # QEMU tests are not compatible with 3.12 yet, try to use an older version in that case
520
- if py3_version >= (3 , 12 , 0 ):
521
- for minor_version in (11 , 10 , 9 ):
522
- found = shutil .which (f"python3.{ minor_version } " , path = python_search_path )
523
- if found :
524
- python_bin = found
525
- break
526
- self .configure_args .append (f"--python={ python_bin } " )
527
527
528
528
# TODO: tests:
529
529
# noinspection PyUnreachableCode
0 commit comments