mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-91831 [debugger]: keep the IDE's PYTHONPATH entries under debugpy
The debugpy launch configuration is assembled outside PythonCommandLineState.startProcess, and it applied the run configuration's own environment variables after the entries the IDE contributes. A PYTHONPATH typed into Environment variables therefore replaced the content roots, the source roots and the interpreter's added paths rather than extending them, and the debuggee failed to import a project module. Run mode and the pydevd backend order the two the other way round, in PythonCommandLineState.initEnvironment. Contribute those entries after the configuration's own variables, through PythonEnvUtil.initPythonPath, so the typed value keeps its precedence and the roots are appended to it. This also preserves a PYTHONPATH coming from an env file, which the previous helper dropped by seeding its merge from getEnvs() alone, and passes isPassParentEnvs instead of an unconditional true so the system PYTHONPATH is not folded in when the debuggee does not inherit the parent environment. The PythonCommandLineState.buildPythonPath(configuration, passParentEnvs) overload was added for this single caller and now has none, so it is removed instead of reshaped; the composition lives next to the launcher that needs it. IJ-MR-220448 Merge-request: IJ-MR-220658 Merged-by: Maxim Popov <maxim.popov@jetbrains.com> GitOrigin-RevId: b3c6145c73291ddf81c3c6a4479dee7572b16a45
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6791cdc352
commit
4ef95291ca
@@ -110,7 +110,6 @@ import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
@@ -908,24 +907,6 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static @NotNull Map<String, String> buildPythonPath(@NotNull AbstractPythonRunConfiguration<?> configuration,
|
||||
boolean passParentEnvs) {
|
||||
Map<String, String> envs = new HashMap<>(configuration.getEnvs());
|
||||
Module module = configuration.getModule();
|
||||
Sdk sdk = configuration.getSdk();
|
||||
|
||||
if (sdk != null) {
|
||||
List<String> pathList = new ArrayList<>();
|
||||
pathList.addAll(getAddedPaths(sdk));
|
||||
pathList.addAll(collectPythonPath(module, configuration.shouldAddContentRoots(), configuration.shouldAddSourceRoots()));
|
||||
PythonEnvUtil.initPythonPath(envs, passParentEnvs, pathList);
|
||||
}
|
||||
|
||||
return envs;
|
||||
}
|
||||
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void buildPythonPath(@NotNull Project project,
|
||||
@Nullable Module module,
|
||||
|
||||
Reference in New Issue
Block a user