@@ -57,6 +57,9 @@ def _get_stdlib_home():
57
57
def _get_svm_binary ():
58
58
return os .path .join (_suite .dir , "graalpython-svm" )
59
59
60
+ def __get_svm_binary_from_graalvm ():
61
+ vmdir = os .path .join (mx .suite ("truffle" ).dir , ".." , "vm" )
62
+ return os .path .join (vmdir , "mxbuild" , "-" .join ([mx .get_os (), mx .get_arch ()]), "graalpython.image" , "graalpython" )
60
63
61
64
def _extract_graalpython_internal_options (args ):
62
65
internal = []
@@ -333,16 +336,19 @@ def find_eclipse():
333
336
return
334
337
335
338
336
- def python_svm (args ):
339
+ def python_build_svm (args ):
337
340
mx .run_mx (
338
341
["--dynamicimports" , "/substratevm,/vm" , "build" ,
339
342
"--force-deprecation-as-warning" , "--dependencies" ,
340
343
"GRAAL_MANAGEMENT,graalpython.image" ],
341
344
nonZeroIsFatal = True
342
345
)
343
- vmdir = os .path .join (mx .suite ("truffle" ).dir , ".." , "vm" )
344
- svm_image = os .path .join (vmdir , "mxbuild" , "-" .join ([mx .get_os (), mx .get_arch ()]), "graalpython.image" , "graalpython" )
345
- shutil .copy (svm_image , os .path .join (_suite .dir , "graalpython-svm" ))
346
+ shutil .copy (__get_svm_binary_from_graalvm (), _get_svm_binary ())
347
+
348
+
349
+ def python_svm (args ):
350
+ python_build_svm (args )
351
+ svm_image = __get_svm_binary_from_graalvm ()
346
352
mx .run ([svm_image ] + args )
347
353
return svm_image
348
354
@@ -942,6 +948,7 @@ def import_python_sources(args):
942
948
'python-update-import' : [update_import_cmd , 'import name' ],
943
949
'delete-graalpython-if-testdownstream' : [delete_self_if_testdownstream , '' ],
944
950
'python-checkcopyrights' : [python_checkcopyrights , 'Make sure code files have copyright notices' ],
951
+ 'python-build-svm' : [python_build_svm , 'build svm image if it is outdated' ],
945
952
'python-svm' : [python_svm , 'run python svm image (building it if it is outdated' ],
946
953
'punittest' : [punittest , '' ],
947
954
'python3-unittests' : [python3_unittests , 'run the cPython stdlib unittests' ],
0 commit comments