Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #77 from koxudaxi/add_python_version
Browse files Browse the repository at this point in the history
Add python version for environment name
  • Loading branch information
koxudaxi authored Jul 25, 2020
2 parents e73c95b + 795ac7a commit 695dd66
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<idea-plugin url="https://github.com/koxudaxi/poetry-pycharm-plugin">
<id>com.koxudaxi.poetry</id>
<name>Poetry</name>
<version>0.0.13</version>
<version>0.1.0</version>
<vendor email="[email protected]">Koudai Aono @koxudaxi</vendor>
<change-notes><![CDATA[
<h2>version 0.1.0</h2>
<p>Features</p>
<ul>
<li>Add python version for environment name [#77]</li>
</ul>
<h2>version 0.0.13</h2>
<p>Bug fixes</p>
<ul>
Expand Down
8 changes: 7 additions & 1 deletion src/com/koxudaxi/poetry/poetry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ fun setupPoetrySdkUnderProgress(project: Project?,
}
}

val suggestedName = "Poetry (${PathUtil.getFileName(projectPath)})"

val pythonVersion = when (python) {
is String -> ApplicationManager.getApplication().executeOnPooledThread<String> { 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)
project?.let { project ->
Expand Down

0 comments on commit 695dd66

Please sign in to comment.