mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
Python: introduce getOr("message"){} API to add errors on an appropriate level.
See `getOr` extension doc. GitOrigin-RevId: 859af221e99f03b99ee2f82e829e83e0f00a9e6d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cea3e7d9c0
commit
105554c91d
@@ -1 +1,3 @@
|
||||
py.venv.error.after.creation=Cound not find venv in {0} after creation. Make sure you have access to this directory.
|
||||
py.venv.error.after.creation=Cound not find venv in {0} after creation. Make sure you have access to this directory.
|
||||
py.venv.error.executing.script=Virtual environment helper script {0} execution failed
|
||||
py.venv.error.cant.base.version=Could not get version of base interpreter
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.python.community.execService.python.validatePythonAndGetVers
|
||||
import com.jetbrains.python.PythonBinary
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import com.jetbrains.python.errorProcessing.getOr
|
||||
import com.jetbrains.python.psi.LanguageLevel
|
||||
import com.jetbrains.python.sdk.PySdkSettings
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor
|
||||
@@ -43,9 +44,9 @@ suspend fun createVenv(
|
||||
}
|
||||
add(venvDir.pathString)
|
||||
}
|
||||
val version = python.validatePythonAndGetVersion().getOr { return it }
|
||||
val version = python.validatePythonAndGetVersion().getOr(PyVenvBundle.message("py.venv.error.cant.base.version")) { return it }
|
||||
val helper = if (version.isAtLeast(LanguageLevel.PYTHON38)) VIRTUALENV_ZIPAPP_NAME else LEGACY_VIRTUALENV_ZIPAPP_NAME
|
||||
execService.executeHelper(python, helper, args, ExecOptions(timeout = 3.minutes)).getOr { return it }
|
||||
execService.executeHelper(python, helper, args, ExecOptions(timeout = 3.minutes)).getOr(PyVenvBundle.message("py.venv.error.executing.script", helper)) { return it }
|
||||
|
||||
|
||||
val venvPython = withContext(Dispatchers.IO) {
|
||||
|
||||
Reference in New Issue
Block a user