@Override public void run(@NotNull Sdk sdk) { final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance(); if (manager != null) { try { manager.runVagrant(myVagrantFolder, myMachineName); PythonSdkType.getInstance().setupSdkPaths(sdk); } catch (ExecutionException e) { throw new RuntimeException(e); } } }
@Override public void consume(@Nullable AbstractProjectSettingsStep settingsStep) { if (myRunnable != null) { myRunnable.run(); } if (settingsStep == null) return; Sdk sdk = settingsStep.getSdk(); final Project project = ProjectManager.getInstance().getDefaultProject(); final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel(); if (sdk instanceof PyDetectedSdk) { final String name = sdk.getName(); VirtualFile sdkHome = ApplicationManager.getApplication() .runWriteAction( new Computable<VirtualFile>() { @Override public VirtualFile compute() { return LocalFileSystem.getInstance().refreshAndFindFileByPath(name); } }); PySdkService.getInstance().solidifySdk(sdk); sdk = SdkConfigurationUtil.setupSdk( ProjectJdkTable.getInstance().getAllJdks(), sdkHome, PythonSdkType.getInstance(), true, null, null); model.addSdk(sdk); settingsStep.setSdk(sdk); try { model.apply(); } catch (ConfigurationException exception) { LOG.error("Error adding detected python interpreter " + exception.getMessage()); } } Project newProject = generateProject(project, settingsStep); if (newProject != null) { SdkConfigurationUtil.setDirectoryProjectSdk(newProject, sdk); final List<Sdk> sdks = PythonSdkType.getAllSdks(); for (Sdk s : sdks) { final SdkAdditionalData additionalData = s.getSdkAdditionalData(); if (additionalData instanceof PythonSdkAdditionalData) { ((PythonSdkAdditionalData) additionalData).reassociateWithCreatedProject(newProject); } } } }