Skip to content

Commit 511d9ff

Browse files
committed
Merge remote-tracking branch 'origin/topic/GR-17900' into topic/GR-17357 to get gate fix
2 parents ddfda7a + 32cf833 commit 511d9ff

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,17 @@ private static String getScriptPath(Env env, String[] args) {
267267
}
268268

269269
private static String getCapiHome(Env env, PythonModule sys) {
270-
return String.join(env.getFileNameSeparator(), getCapiUserBase(env, sys), "lib", "capi");
270+
String pythonSubdir = "python" + PythonLanguage.MAJOR + "." + PythonLanguage.MINOR;
271+
return String.join(env.getFileNameSeparator(), getCapiUserBase(env, sys), "lib", pythonSubdir, "capi");
271272
}
272273

273274
// similar to 'sysconfig._getuserbase()'
274275
private static String getCapiUserBase(Env env, PythonModule sys) {
276+
String customUserBase = env.getEnvironment().get("PYTHONUSERBASE");
277+
if (customUserBase != null) {
278+
return customUserBase;
279+
}
280+
275281
Object osName = sys.getAttribute("platform");
276282
if (FRAMEWORK != PNone.NONE && PLATFORM_DARWIN.equals(osName)) {
277283
String _framework = FRAMEWORK.toString();

mx.graalpython/mx_graalpython.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def do_run_python(args, extra_vm_args=None, env=None, jdk=None, **kwargs):
112112
check_vm()
113113

114114
dists = ['GRAALPYTHON', 'TRUFFLE_NFI', 'SULONG']
115+
env["PYTHONUSERBASE"] = mx_subst.path_substitutions.substitute("<path:PYTHON_USERBASE>")
115116

116117
vm_args, graalpython_args = mx.extract_VM_args(args, useDoubleDash=True, defaultAllVMArgs=False)
117118
graalpython_args, additional_dists = _extract_graalpython_internal_options(graalpython_args)
@@ -147,7 +148,7 @@ def do_run_python(args, extra_vm_args=None, env=None, jdk=None, **kwargs):
147148
vm_args += extra_vm_args
148149

149150
vm_args.append("com.oracle.graal.python.shell.GraalPythonMain")
150-
return mx.run_java(vm_args + graalpython_args, jdk=jdk, **kwargs)
151+
return mx.run_java(vm_args + graalpython_args, jdk=jdk, env=env, **kwargs)
151152

152153

153154
def punittest(args):

mx.graalpython/suite.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@
289289
"distDependencies": [
290290
"sdk:GRAAL_SDK",
291291
"sdk:LAUNCHER_COMMON",
292+
"PYTHON_USERBASE",
292293
],
293294
"description": "GraalPython launcher",
294295
},
@@ -383,5 +384,15 @@
383384
},
384385
"maven": False,
385386
},
387+
388+
"PYTHON_USERBASE": {
389+
"native": True,
390+
"platformDependent": False,
391+
"description": "Blub",
392+
"layout": {
393+
"./README.md": "string:User base directory for development purpose.",
394+
},
395+
"maven": False,
396+
},
386397
},
387398
}

0 commit comments

Comments
 (0)