mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Update sdk paths after interpreter add (PY-13379).
This commit is contained in:
@@ -74,7 +74,6 @@ import com.jetbrains.python.psi.search.PyProjectScopeBuilder;
|
||||
import com.jetbrains.python.remote.PythonRemoteInterpreterManager;
|
||||
import com.jetbrains.python.sdk.flavors.CPythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.skeletons.PySkeletonRefresher;
|
||||
import icons.PythonIcons;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -555,7 +554,7 @@ public class PythonSdkType extends SdkType {
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
try {
|
||||
final String skeletonsPath = getSkeletonsPath(PathManager.getSystemPath(), sdk.getHomePath());
|
||||
PySkeletonRefresher.refreshSkeletonsOfSdk(project, ownerComponent, skeletonsPath, null, sdk);
|
||||
PythonSdkUpdater.updateSdk(project, ownerComponent, sdk, skeletonsPath);
|
||||
}
|
||||
catch (InvalidSdkException e) {
|
||||
// If the SDK is invalid, the user should worry about the SDK itself, not about skeletons generation errors
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.openapi.projectRoots.SdkModificator;
|
||||
import com.intellij.openapi.projectRoots.SdkTypeId;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.startup.StartupActivity;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -41,9 +42,12 @@ import com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil;
|
||||
import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase;
|
||||
import com.jetbrains.python.sdk.skeletons.PySkeletonRefresher;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A component that initiates a refresh of all project's Python SDKs.
|
||||
@@ -119,7 +123,7 @@ public class PythonSdkUpdater implements StartupActivity {
|
||||
for (final Sdk sdk : sdksToUpdate) {
|
||||
try {
|
||||
LOG.info("Performing background update of skeletons for SDK " + sdk.getHomePath());
|
||||
updateSdk(project, sdk);
|
||||
updateSdk(project, null, sdk, PythonSdkType.findSkeletonsPath(sdk));
|
||||
}
|
||||
catch (InvalidSdkException e) {
|
||||
if (PythonSdkType.isRemote(sdk)) {
|
||||
@@ -144,8 +148,8 @@ public class PythonSdkUpdater implements StartupActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private static void updateSdk(@NotNull Project project, @NotNull final Sdk sdk) throws InvalidSdkException {
|
||||
PySkeletonRefresher.refreshSkeletonsOfSdk(project, sdk); // NOTE: whole thing would need a rename
|
||||
public static void updateSdk(@Nullable Project project, @Nullable Component ownerComponent, @NotNull final Sdk sdk, String skeletonsPath) throws InvalidSdkException {
|
||||
PySkeletonRefresher.refreshSkeletonsOfSdk(project, ownerComponent, skeletonsPath, new Ref<Boolean>(false), sdk); // NOTE: whole thing would need a rename
|
||||
if (!PySdkUtil.isRemote(sdk)) {
|
||||
updateSysPath(sdk);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user