@@ -54,6 +54,15 @@ def _get_stdlib_home():
54
54
return os .path .join (SUITE .dir , "graalpython" , "lib-python" , "3" )
55
55
56
56
57
+ def _get_svm_binary ():
58
+ return os .path .join (SUITE .dir , "graalpython-svm" )
59
+
60
+
61
+ def __get_svm_binary_from_graalvm ():
62
+ vmdir = os .path .join (mx .suite ("truffle" ).dir , ".." , "vm" )
63
+ return os .path .join (vmdir , "mxbuild" , "-" .join ([mx .get_os (), mx .get_arch ()]), "graalpython.image" , "graalpython" )
64
+
65
+
57
66
def _extract_graalpython_internal_options (args ):
58
67
non_internal = []
59
68
additional_dists = []
@@ -215,6 +224,16 @@ def find_eclipse():
215
224
return
216
225
217
226
227
+ def python_build_svm (args ):
228
+ mx .run_mx (
229
+ ["--dynamicimports" , "/substratevm,/vm" , "build" ,
230
+ "--force-deprecation-as-warning" , "--dependencies" ,
231
+ "GRAAL_MANAGEMENT,graalpython.image" ],
232
+ nonZeroIsFatal = True
233
+ )
234
+ shutil .copy (__get_svm_binary_from_graalvm (), _get_svm_binary ())
235
+
236
+
218
237
_SVM_ARGS = ["--dynamicimports" , "/vm,/tools,/substratevm" ,
219
238
"--disable-polyglot" , "--disable-libpolyglot" ]
220
239
@@ -857,6 +876,7 @@ def mx_post_parse_cmd_line(namespace):
857
876
'python-update-import' : [update_import_cmd , 'import name' ],
858
877
'delete-graalpython-if-testdownstream' : [delete_self_if_testdownstream , '' ],
859
878
'python-checkcopyrights' : [python_checkcopyrights , 'Make sure code files have copyright notices' ],
879
+ 'python-build-svm' : [python_build_svm , 'build svm image if it is outdated' ],
860
880
'python-svm' : [python_svm , 'run python svm image (building it if it is outdated' ],
861
881
'punittest' : [punittest , '' ],
862
882
'python3-unittests' : [python3_unittests , 'run the cPython stdlib unittests' ],
0 commit comments