mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PY-84953: Unify tool detection approach
Our tool detection approach varies a lot. We have different logic for uv, poetry and other tools. Also, uv detection is not suspendable and doesn't have any explicit thread requirements, even though it performs I/O operations. This change makes such detection unified and suspendable (where possible) and moves it to BGT. GitOrigin-RevId: 31701e9f0a66a25628f1b5c1e4f1864692e38217
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cc31c32ec6
commit
7a59af143c
@@ -3,11 +3,9 @@ package com.intellij.python.hatch
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.platform.eel.EelApi
|
||||
import com.intellij.platform.eel.LocalEelApi
|
||||
import com.intellij.platform.eel.provider.asNioPath
|
||||
import com.intellij.platform.eel.provider.localEel
|
||||
import com.intellij.platform.eel.where
|
||||
import com.intellij.python.hatch.runtime.getHatchCommand
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.sdk.detectTool
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.isExecutable
|
||||
|
||||
@@ -40,10 +38,6 @@ object HatchConfiguration {
|
||||
return result
|
||||
}
|
||||
|
||||
suspend fun detectHatchExecutable(eelApi: EelApi): Path? {
|
||||
val hatchCommand = eelApi.getHatchCommand()
|
||||
val hatchPath = eelApi.exec.where(hatchCommand)?.asNioPath()
|
||||
return hatchPath
|
||||
}
|
||||
suspend fun detectHatchExecutable(eelApi: EelApi): Path? = detectTool("hatch", eelApi).successOrNull
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.intellij.python.hatch.runtime
|
||||
|
||||
import com.intellij.platform.eel.EelApi
|
||||
import com.intellij.platform.eel.EelPlatform
|
||||
|
||||
fun EelApi.getHatchCommand(): String = when (platform) {
|
||||
is EelPlatform.Windows -> "hatch.exe"
|
||||
else -> "hatch"
|
||||
}
|
||||
Reference in New Issue
Block a user