@Nullable @Override protected String getHelperPath(String helper) throws ExecutionException { final Sdk sdk = getSdk(); final SdkAdditionalData sdkData = sdk.getSdkAdditionalData(); if (sdkData instanceof PyRemoteSdkAdditionalDataBase) { final PyRemoteSdkAdditionalDataBase remoteSdkData = (PyRemoteSdkAdditionalDataBase) sdkData; try { String helpersPath; if (CaseCollector.useRemoteCredentials(remoteSdkData)) { final RemoteSdkCredentials remoteSdkCredentials = remoteSdkData.getRemoteSdkCredentials(false); helpersPath = remoteSdkCredentials.getHelpersPath(); } else { helpersPath = remoteSdkData.getHelpersPath(); } if (!StringUtil.isEmpty(helpersPath)) { return new RemoteFile(helpersPath, helper).getPath(); } else { return null; } } catch (InterruptedException e) { LOG.error(e); } catch (ExecutionException e) { throw analyzeException(e, helper, Collections.<String>emptyList()); } } return null; }
private Process createRemoteConsoleProcess( PythonRemoteInterpreterManager manager, String[] command, Map<String, String> env) throws ExecutionException { PyRemoteSdkAdditionalDataBase data = (PyRemoteSdkAdditionalDataBase) mySdk.getSdkAdditionalData(); assert data != null; GeneralCommandLine commandLine = new GeneralCommandLine(command); commandLine.getEnvironment().putAll(env); commandLine .getParametersList() .set( 1, PythonRemoteInterpreterManager.toSystemDependent( new File(data.getHelpersPath(), PYDEV_PYDEVCONSOLE_PY).getPath(), PySourcePosition.isWindowsPath(data.getInterpreterPath()))); commandLine.getParametersList().set(2, "0"); commandLine.getParametersList().set(3, "0"); myCommandLine = commandLine.getCommandLineString(); try { myRemoteCredentials = data.getRemoteSdkCredentials(true); PathMappingSettings mappings = manager.setupMappings(getProject(), data, null); RemoteSshProcess remoteProcess = manager.createRemoteProcess( getProject(), myRemoteCredentials, mappings, commandLine, true); Couple<Integer> remotePorts = getRemotePortsFromProcess(remoteProcess); remoteProcess.addLocalTunnel(myPorts[0], myRemoteCredentials.getHost(), remotePorts.first); remoteProcess.addRemoteTunnel(remotePorts.second, "localhost", myPorts[1]); myPydevConsoleCommunication = new PydevRemoteConsoleCommunication(getProject(), myPorts[0], remoteProcess, myPorts[1]); return remoteProcess; } catch (Exception e) { throw new ExecutionException(e.getMessage()); } }