fix confusion between SDK paths when "use module SDK" option is selected and a Python SDK is configured (PY-9021)

This commit is contained in:
Dmitry Jemerov
2013-02-28 14:59:45 +01:00
parent 95c61f72da
commit 0384e217d6
2 changed files with 18 additions and 9 deletions
@@ -183,6 +183,15 @@ public abstract class AbstractPythonRunConfiguration<T extends AbstractRunConfig
return sdkHome;
}
public Sdk getSdk() {
if (myUseModuleSdk) {
return PythonSdkType.findPythonSdk(getModule());
}
else {
return PythonSdkType.findSdkByPath(getSdkHome());
}
}
public void readExternal(Element element) throws InvalidDataException {
super.readExternal(element);
myInterpreterOptions = JDOMExternalizerUtil.readField(element, "INTERPRETER_OPTIONS");
@@ -275,13 +284,13 @@ public abstract class AbstractPythonRunConfiguration<T extends AbstractRunConfig
* @param commandLine what to patch
*/
public void patchCommandLine(GeneralCommandLine commandLine) {
final String sdk_home = getSdkHome();
Sdk sdk = PythonSdkType.findPythonSdk(getModule());
if (sdk != null && sdk_home != null) {
patchCommandLineFirst(commandLine, sdk_home);
patchCommandLineForVirtualenv(commandLine, sdk_home);
patchCommandLineForBuildout(commandLine, sdk_home);
patchCommandLineLast(commandLine, sdk_home);
final String interpreterPath = getInterpreterPath();
Sdk sdk = getSdk();
if (sdk != null && interpreterPath != null) {
patchCommandLineFirst(commandLine, interpreterPath);
patchCommandLineForVirtualenv(commandLine, interpreterPath);
patchCommandLineForBuildout(commandLine, interpreterPath);
patchCommandLineLast(commandLine, interpreterPath);
}
}
@@ -89,7 +89,7 @@ public abstract class PythonCommandLineState extends CommandLineState {
@Nullable
public PythonSdkFlavor getSdkFlavor() {
return PythonSdkFlavor.getFlavor(myConfig.getSdkHome());
return PythonSdkFlavor.getFlavor(myConfig.getInterpreterPath());
}
@Override
@@ -150,7 +150,7 @@ public abstract class PythonCommandLineState extends CommandLineState {
PythonRunConfigurationExtensionsManager.getInstance()
.patchCommandLine(myConfig, runnerSettings, commandLine, getConfigurationSettings().getRunnerId());
Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getSdkHome());
Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getInterpreterPath());
final ProcessHandler processHandler;