mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
fixup! fixup! fixup! [python] PY-84973 Create venv implicitly for welcome project
(cherry picked from commit bacc7302668bdc779b952af7774a1d42094f4bc2) IJ-MR-179754 GitOrigin-RevId: f4b1977b09de1ef4efe82235c6263bfc86a063a5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
725f5752ab
commit
3c437c28b4
+11
-5
@@ -32,6 +32,7 @@ import com.jetbrains.python.errorProcessing.PyResult
|
||||
import com.jetbrains.python.errorProcessing.getOr
|
||||
import com.jetbrains.python.mapResult
|
||||
import com.jetbrains.python.projectCreation.createVenvAndSdk
|
||||
import com.jetbrains.python.sdk.pythonSdk
|
||||
import kotlinx.coroutines.*
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.io.IOException
|
||||
@@ -67,10 +68,10 @@ suspend fun createMiscProject(
|
||||
systemPythonService: SystemPythonService = SystemPythonService(),
|
||||
currentProject: Project? = null,
|
||||
): PyResult<Job> {
|
||||
return createProjectAndSdk(projectPath,
|
||||
confirmInstallation = confirmInstallation,
|
||||
systemPythonService = systemPythonService,
|
||||
currentProject = currentProject,
|
||||
return createOrOpenProjectAndSdk(projectPath,
|
||||
confirmInstallation = confirmInstallation,
|
||||
systemPythonService = systemPythonService,
|
||||
currentProject = currentProject,
|
||||
).mapResult { (project, sdk) ->
|
||||
Result.Success(scopeProvider(project).launch {
|
||||
withBackgroundProgress(project, PyCharmCommunityCustomizationBundle.message("misc.project.filling.file")) {
|
||||
@@ -139,7 +140,7 @@ private suspend fun generateFile(where: Path, templateFileName: TemplateFileName
|
||||
* Pythons are searched using [systemPythonService].
|
||||
* If no Python found and [confirmInstallation] we install it using [SystemPythonService.getInstaller]
|
||||
*/
|
||||
private suspend fun createProjectAndSdk(
|
||||
private suspend fun createOrOpenProjectAndSdk(
|
||||
projectPath: Path,
|
||||
confirmInstallation: suspend () -> Boolean,
|
||||
systemPythonService: SystemPythonService,
|
||||
@@ -152,6 +153,11 @@ private suspend fun createProjectAndSdk(
|
||||
openProject(projectPath)
|
||||
}
|
||||
|
||||
val existingSdk = project.pythonSdk
|
||||
if (isAlreadyMiscOrWelcomeScreenProject && existingSdk != null) {
|
||||
return PyResult.success(project to existingSdk)
|
||||
}
|
||||
|
||||
val vfsProjectPath = createProjectDir(projectPath).getOr { return it }
|
||||
// Even if the misc project might be already opened, it might not have sdk (if it was opened as a welcome project)
|
||||
val sdkResult = withContext(Dispatchers.EDT) {
|
||||
|
||||
Reference in New Issue
Block a user