From b562d7dc7b711a20e9c17557464d8028a25aaf64 Mon Sep 17 00:00:00 2001 From: Koudai Aono Date: Sat, 25 Jul 2020 01:38:23 +0900 Subject: [PATCH 1/3] add python version for environment name --- src/com/koxudaxi/poetry/poetry.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/koxudaxi/poetry/poetry.kt b/src/com/koxudaxi/poetry/poetry.kt index 102ff5c..8060373 100644 --- a/src/com/koxudaxi/poetry/poetry.kt +++ b/src/com/koxudaxi/poetry/poetry.kt @@ -173,7 +173,13 @@ fun setupPoetrySdkUnderProgress(project: Project?, } } - val suggestedName = "Poetry (${PathUtil.getFileName(projectPath)})" + val pythonVersion = ReadAction.compute { + when (python) { + is String -> runCommand(FileUtil.toSystemDependentName(projectPath), python, "-V") + else -> runPoetry(FileUtil.toSystemDependentName(projectPath), "run", "python", "-V") + }.trim() + } + val suggestedName = "Poetry (${PathUtil.getFileName(projectPath)}) $pythonVersion" return createSdkByGenerateTask(task, existingSdks, null, projectPath, suggestedName)?.apply { associateWithModule(module ?: project?.modules?.firstOrNull(), newProjectPath) project?.let { project -> From f0264cc4f72bd0fabcc1324295a1b510da717e50 Mon Sep 17 00:00:00 2001 From: Koudai Aono Date: Sun, 26 Jul 2020 02:32:25 +0900 Subject: [PATCH 2/3] fix sync tasks --- src/com/koxudaxi/poetry/poetry.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/com/koxudaxi/poetry/poetry.kt b/src/com/koxudaxi/poetry/poetry.kt index 8060373..a92b04c 100644 --- a/src/com/koxudaxi/poetry/poetry.kt +++ b/src/com/koxudaxi/poetry/poetry.kt @@ -173,12 +173,12 @@ fun setupPoetrySdkUnderProgress(project: Project?, } } - val pythonVersion = ReadAction.compute { - when (python) { - is String -> runCommand(FileUtil.toSystemDependentName(projectPath), python, "-V") - else -> runPoetry(FileUtil.toSystemDependentName(projectPath), "run", "python", "-V") - }.trim() - } + + val pythonVersion = when (python) { + is String -> ApplicationManager.getApplication().executeOnPooledThread { runCommand(FileUtil.toSystemDependentName(projectPath), python, "-V") }.get(10, TimeUnit.SECONDS) + else -> syncRunPoetry(FileUtil.toSystemDependentName(projectPath), "run", "python", "-V", defaultResult = null){it} + }?.trim() + val suggestedName = "Poetry (${PathUtil.getFileName(projectPath)}) $pythonVersion" return createSdkByGenerateTask(task, existingSdks, null, projectPath, suggestedName)?.apply { associateWithModule(module ?: project?.modules?.firstOrNull(), newProjectPath) From 795ac7ae976489a9a4502b692f05287e97e63271 Mon Sep 17 00:00:00 2001 From: Koudai Aono Date: Sun, 26 Jul 2020 02:39:35 +0900 Subject: [PATCH 3/3] update history --- resources/META-INF/plugin.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index db0bfbb..ccf90c7 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -1,9 +1,14 @@ com.koxudaxi.poetry Poetry - 0.0.13 + 0.1.0 Koudai Aono @koxudaxi version 0.1.0 +

Features

+
    +
  • Add python version for environment name [#77]
  • +

version 0.0.13

Bug fixes