Skip to content

Commit 4e2a1d3

Browse files
committed
expose the python home in sys
1 parent d05c426 commit 4e2a1d3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ protected Object findMetaObject(PythonContext context, Object value) {
325325
return null;
326326
}
327327

328+
public String getHome() {
329+
return getLanguageHome();
330+
}
331+
328332
public static PythonLanguage getCurrent() {
329333
return getCurrentLanguage(PythonLanguage.class);
330334
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SysModuleBuiltins.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public void initialize(PythonCore core) {
168168
PythonOptions.getFlag(core.getContext(), PythonOptions.QuietFlag), // quiet
169169
PythonOptions.getFlag(core.getContext(), PythonOptions.VerboseFlag), // verbose
170170
}));
171+
builtinConstants.put("graal_python_home", core.getContext().getLanguage().getHome());
171172
builtinConstants.put("graal_python_core_home", PythonOptions.getOption(core.getContext(), PythonOptions.CoreHome));
172173
builtinConstants.put("graal_python_stdlib_home", PythonOptions.getOption(core.getContext(), PythonOptions.StdLibHome));
173174
builtinConstants.put("graal_python_opaque_filesystem", PythonOptions.getOption(core.getContext(), PythonOptions.OpaqueFilesystem));

0 commit comments

Comments
 (0)