|
30 | 30 | import java.io.File;
|
31 | 31 | import java.io.FileDescriptor;
|
32 | 32 | import java.io.FileOutputStream;
|
33 |
| -import java.io.IOError; |
34 | 33 | import java.io.IOException;
|
35 | 34 | import java.io.InputStream;
|
36 | 35 | import java.io.OutputStream;
|
@@ -717,8 +716,7 @@ protected void launch(Builder contextBuilder) {
|
717 | 716 | // the user did not explicitly pass some options that would be otherwise loaded from
|
718 | 717 | // pyvenv.cfg. Notable usage of this feature is GraalPython venvs which generate a
|
719 | 718 | // launcher script that passes those options explicitly without relying on pyvenv.cfg
|
720 |
| - boolean tryVenvCfg = !hasContextOptionSetViaCommandLine("SysPrefix") && |
721 |
| - !hasContextOptionSetViaCommandLine("PythonHome") && |
| 719 | + boolean tryVenvCfg = !hasContextOptionSetViaCommandLine("PythonHome") && |
722 | 720 | getEnv("GRAAL_PYTHONHOME") == null;
|
723 | 721 | if (tryVenvCfg) {
|
724 | 722 | findAndApplyVenvCfg(contextBuilder, executable);
|
@@ -872,6 +870,7 @@ private static String toAbsolutePath(String executable) {
|
872 | 870 | return Paths.get(executable).toAbsolutePath().toString();
|
873 | 871 | }
|
874 | 872 |
|
| 873 | + // Rough equivalent of CPython's pyvenv.cfg logic in Modules/getpath.py |
875 | 874 | private void findAndApplyVenvCfg(Builder contextBuilder, String executable) {
|
876 | 875 | Path binDir;
|
877 | 876 | try {
|
@@ -927,16 +926,6 @@ private void findAndApplyVenvCfg(Builder contextBuilder, String executable) {
|
927 | 926 | // NullPointerException covers the possible null result of getParent()
|
928 | 927 | warn("Could not set PYTHONHOME according to the pyvenv.cfg file.");
|
929 | 928 | }
|
930 |
| - String sysPrefix = null; |
931 |
| - try { |
932 |
| - sysPrefix = venvCfg.getParent().toAbsolutePath().toString(); |
933 |
| - } catch (IOError | NullPointerException ex) { |
934 |
| - // NullPointerException covers the possible null result of getParent() |
935 |
| - warn("Could not set the sys.prefix according to the pyvenv.cfg file."); |
936 |
| - } |
937 |
| - if (sysPrefix != null) { |
938 |
| - contextBuilder.option("python.SysPrefix", sysPrefix); |
939 |
| - } |
940 | 929 | break;
|
941 | 930 | }
|
942 | 931 | }
|
|
0 commit comments