From cd54c4655cfe17bfe4beeebf9f92ccb6285b3ce3 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Thu, 7 Jun 2018 21:03:11 +0300 Subject: [PATCH] PY-26492 Warning about missing pipenv with the comment on how to specify the path to it --- .../com/jetbrains/python/sdk/add/PyAddPipEnvPanel.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/sdk/add/PyAddPipEnvPanel.kt b/python/src/com/jetbrains/python/sdk/add/PyAddPipEnvPanel.kt index 836140468a18..3b9b7102b2ec 100644 --- a/python/src/com/jetbrains/python/sdk/add/PyAddPipEnvPanel.kt +++ b/python/src/com/jetbrains/python/sdk/add/PyAddPipEnvPanel.kt @@ -7,6 +7,7 @@ import com.intellij.openapi.module.ModuleUtil import com.intellij.openapi.project.Project import com.intellij.openapi.projectRoots.Sdk import com.intellij.openapi.ui.ValidationInfo +import com.intellij.openapi.util.SystemInfo import com.intellij.ui.components.JBCheckBox import com.intellij.util.PlatformUtils import com.intellij.util.ui.FormBuilder @@ -106,13 +107,19 @@ class PyAddPipEnvPanel(private val project: Project?, * Checks if `pipenv` is available on `$PATH`. */ private fun validatePipEnvExecutable(): ValidationInfo? { - val executable = getPipEnvExecutable() ?: return ValidationInfo("Pipenv executable is not found on \$PATH") + val tip = "Specify the correct path to pipenv in ${getSettingsMenuName()} | Tools | Python Integrated Tools." + val executable = getPipEnvExecutable() ?: return ValidationInfo("Pipenv executable is not found on \$PATH. $tip") return when { - !executable.exists() -> ValidationInfo("${executable.absolutePath} is not found") + !executable.exists() -> ValidationInfo("File ${executable.absolutePath} is not found. $tip") !executable.canExecute() -> ValidationInfo("Cannot execute ${executable.absolutePath}") else -> null } } + private fun getSettingsMenuName() = + when { + SystemInfo.isMac -> "Preferences" + else -> "Settings" + } /** * Checks if the pipenv for the project hasn't been already added.