PY-85897 PY-88188: (WIP) Move HelpersAwareTargetEnvironmentRequest to exec service to upload/map helpers from service.

(cherry picked from commit bdefb75a59f8b43e048b655490595bf064f711e9)

GitOrigin-RevId: b3d9f44193c72a8254d1917e3c5ab18478579c51
This commit is contained in:
Ilya.Kazakevich
2026-03-25 21:21:21 +00:00
committed by intellij-monorepo-bot
parent f37d8d50fa
commit 9ad1c77a94
7 changed files with 15 additions and 0 deletions
+2
View File
@@ -43,6 +43,7 @@ jvm_library(
"//platform/remote-servers/impl",
"//libraries/guava",
"//python/python-process-output/common",
"//python/impl.helperLocator:community-helpersLocator",
]
)
@@ -80,6 +81,7 @@ jvm_library(
"//platform/remote-servers/impl",
"//libraries/guava",
"//python/python-process-output/common",
"//python/impl.helperLocator:community-helpersLocator",
]
)
### auto-generated section `build intellij.python.community.execService` end
@@ -54,5 +54,6 @@
<orderEntry type="module" module-name="intellij.platform.remoteServers.impl" />
<orderEntry type="module" module-name="intellij.libraries.guava" />
<orderEntry type="module" module-name="intellij.python.processOutput.common" />
<orderEntry type="module" module-name="intellij.python.community.helpersLocator" />
</component>
</module>
@@ -9,11 +9,14 @@ import com.intellij.execution.target.value.getRelativeTargetPath
import com.intellij.openapi.util.io.FileUtil
import com.intellij.python.community.helpersLocator.PythonHelpersLocator
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread
import org.jetbrains.annotations.ApiStatus
import java.nio.file.Path
import kotlin.io.path.absolutePathString
@ApiStatus.Internal
data class PathMapping(val localPath: Path, val targetPathFun: TargetEnvironmentFunction<FullPathOnTarget>)
@ApiStatus.Internal
data class PythonHelpersMappings(val helpers: List<PathMapping>)
/**
@@ -28,22 +31,27 @@ interface HelpersAwareTargetEnvironmentRequest {
* helpers scripts.
*/
@RequiresBackgroundThread
@ApiStatus.Internal
fun preparePyCharmHelpers(): PythonHelpersMappings
}
@ApiStatus.Internal
fun getPythonHelpers(): List<Path> = PythonHelpersLocator.getHelpersRoots()
/**
* Returns the mappings where Python helpers of Community and Professional versions are mapped to a single directory.
* For example, when their contents are uploaded to the same directory on the SSH machine.
*/
@ApiStatus.Internal
fun singleDirectoryPythonHelpersMappings(targetPathFun: TargetEnvironmentFunction<FullPathOnTarget>): PythonHelpersMappings =
PythonHelpersMappings(getPythonHelpers().map { it to targetPathFun })
@ApiStatus.Internal
infix fun Path.to(targetPathFun: TargetEnvironmentFunction<FullPathOnTarget>): PathMapping =
PathMapping(localPath = this, targetPathFun)
@ApiStatus.Internal
fun String.tryResolveAsPythonHelperDir(mappings: PythonHelpersMappings): PathMapping? {
val thisLocalPath = Path.of(this)
val rootPaths = mappings.helpers
@@ -3,6 +3,7 @@
<dependencies>
<module name="intellij.platform.testFramework.junit5.eel._test"/>
<module name="intellij.python.community.execService"/>
<module name="intellij.python.community.helpersLocator"/>
<module name="intellij.python.processOutput.common"/>
</dependencies>
<!-- endregion -->
@@ -57,6 +57,7 @@ jvm_library(
"//platform/execution",
"//platform/lang-api:lang",
"//platform/forms_rt:java-guiForms-rt",
"//python/python-exec-service:community-execService",
":platform_lang-impl_provided",
":platform_execution-impl_provided",
":python-community-impl_provided",
@@ -31,5 +31,6 @@
<orderEntry type="module" module-name="intellij.platform.execution" />
<orderEntry type="module" module-name="intellij.platform.lang" />
<orderEntry type="module" module-name="intellij.java.guiForms.rt" />
<orderEntry type="module" module-name="intellij.python.community.execService" />
</component>
</module>
@@ -1,6 +1,7 @@
<idea-plugin>
<dependencies>
<plugin id="com.intellij.modules.python"/>
<module name="intellij.python.community.execService"/>
</dependencies>
<extensions defaultExtensionNs="com.intellij">