@@ -71,6 +71,7 @@ public static void main(String[] args) {
7171 private boolean stdinIsInteractive = System .console () != null ;
7272 private boolean runLLI = false ;
7373 private VersionAction versionAction = VersionAction .None ;
74+ private String sulongLibraryPath = null ;
7475
7576 @ Override
7677 protected List <String > preprocessArguments (List <String > arguments , Map <String , String > polyglotOptions ) {
@@ -232,6 +233,7 @@ protected void launch(Builder contextBuilder) {
232233 noUserSite = noUserSite || System .getenv ("PYTHONNOUSERSITE" ) != null ;
233234 verboseFlag = verboseFlag || System .getenv ("PYTHONVERBOSE" ) != null ;
234235 }
236+ sulongLibraryPath = System .getenv ("SULONG_LIBRARY_PATH" );
235237
236238 // setting this to make sure our TopLevelExceptionHandler calls the excepthook
237239 // to print Python exceptions
@@ -244,6 +246,9 @@ protected void launch(Builder contextBuilder) {
244246 contextBuilder .option ("python.QuietFlag" , Boolean .toString (quietFlag ));
245247 contextBuilder .option ("python.NoUserSiteFlag" , Boolean .toString (noUserSite ));
246248 contextBuilder .option ("python.NoSiteFlag" , Boolean .toString (noSite ));
249+ if (sulongLibraryPath != null ) {
250+ contextBuilder .option ("llvm.libraryPath" , sulongLibraryPath );
251+ }
247252
248253 ConsoleHandler consoleHandler = createConsoleHandler (System .in , System .out );
249254 contextBuilder .arguments (getLanguageId (), programArgs .toArray (new String [0 ])).in (consoleHandler .createInputStream ());
@@ -416,7 +421,9 @@ protected void printHelp(OptionCategory maxCategory) {
416421 "PYTHONHASHSEED: if this variable is set to 'random', the effect is the same\n " +
417422 " as specifying the -R option: a random value is used to seed the hashes of\n " +
418423 " str, bytes and datetime objects. It can also be set to an integer\n " +
419- " in the range [0,4294967295] to get hash values with a predictable seed." );
424+ " in the range [0,4294967295] to get hash values with a predictable seed.\n " +
425+ "SULONG_LIBRARY_PATH: Specifies the library path for Sulong.\n " +
426+ " This is required when starting subprocesses of python." );
420427 if (maxCategory .compareTo (OptionCategory .DEBUG ) >= 0 ) {
421428 print ("\n GraalPython performance debugging options:\n " +
422429 "-debug-perf : Enable tracing of Truffle compilations and its warnings\n " +
0 commit comments