From 3e8c949bcf1209a6d2aa777034430155ee7f6e29 Mon Sep 17 00:00:00 2001 From: Alexander Koshevoy Date: Tue, 22 Nov 2016 14:34:51 +0300 Subject: [PATCH] PY-19877 Default volume binding from project directory to /opt/project docker container path added for Python console --- .../python/console/PydevConsoleRunnerImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java b/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java index ac650a4456ba..4868acd9c2e8 100644 --- a/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java +++ b/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java @@ -131,6 +131,7 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { public static final String PYDEV_PYDEVCONSOLE_PY = "pydev/pydevconsole.py"; public static final int PORTS_WAITING_TIMEOUT = 20000; private static final String CONSOLE_FEATURE = "python.console"; + private static final String DOCKER_CONTAINER_PROJECT_PATH = "/opt/project"; private final Project myProject; private final String myTitle; private final String myWorkingDir; @@ -446,6 +447,10 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { commandLine.putUserData(PyRemoteProcessStarter.OPEN_FOR_INCOMING_CONNECTION, true); + // we do not have an option to setup Docker container settings now for Python console so we should bind at least project + // directory to some path inside the Docker container + commandLine.putUserData(PythonRemoteInterpreterManager.ADDITIONAL_MAPPINGS, buildDockerPathMappings()); + myRemoteProcessHandlerBase = PyRemoteProcessStarterManagerUtil .getManager(data).startRemoteProcess(myProject, commandLine, manager, data, pathMapper); @@ -486,6 +491,12 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { } } + @NotNull + private PathMappingSettings buildDockerPathMappings() { + return new PathMappingSettings(Collections.singletonList(new PathMappingSettings.PathMapping(myProject.getBasePath(), + DOCKER_CONTAINER_PROJECT_PATH))); + } + private static Couple getRemotePortsFromProcess(RemoteProcess process) throws ExecutionException { Scanner s = new Scanner(process.getInputStream());