@@ -259,7 +259,14 @@ def hosting_registry(self):
259
259
260
260
def run (self , cwd , args ):
261
261
_check_vm_args (self .name (), args )
262
+ extra_polyglot_args = ["--experimental-options" ]
262
263
264
+ host_vm = self .host_vm ()
265
+ if hasattr (host_vm , 'run_lang' ): # this is a full GraalVM build
266
+ with environ (self ._env or {}):
267
+ return host_vm .run_lang ('graalpython' , extra_polyglot_args + args , cwd )
268
+
269
+ # Otherwise, we're running from the source tree
263
270
truffle_options = [
264
271
# '-Dgraal.TruffleCompilationExceptionsAreFatal=true'
265
272
]
@@ -278,7 +285,7 @@ def run(self, cwd, args):
278
285
if mx .suite ("sulong-managed" , fatalIfMissing = False ):
279
286
dists .append ('SULONG_MANAGED' )
280
287
281
- extra_polyglot_args += ["--experimental-options" , "-- python.CAPI=%s" % SUITE .extensions ._get_capi_home () ]
288
+ extra_polyglot_args += ["--python.CAPI=%s" % SUITE .extensions ._get_capi_home ()]
282
289
283
290
vm_args = mx .get_runtime_jvm_args (dists , cp_suffix = self ._cp_suffix , cp_prefix = self ._cp_prefix )
284
291
if isinstance (self ._extra_vm_args , list ):
@@ -293,14 +300,10 @@ def run(self, cwd, args):
293
300
args .remove (a )
294
301
cmd = truffle_options + vm_args + extra_polyglot_args + args
295
302
296
- host_vm = self .host_vm ()
297
303
if not self ._env :
298
304
self ._env = dict ()
299
305
with environ (self ._env ):
300
- if hasattr (host_vm , 'run_lang' ):
301
- return host_vm .run_lang ('graalpython' , extra_polyglot_args + args , cwd )
302
- else :
303
- return host_vm .run (cwd , cmd )
306
+ return host_vm .run (cwd , cmd )
304
307
305
308
def name (self ):
306
309
return VM_NAME_GRAALPYTHON
0 commit comments