diff --git a/python/python-exec-service/BUILD.bazel b/python/python-exec-service/BUILD.bazel index 3cb6d0d3cd60..25a35dc4cb3f 100644 --- a/python/python-exec-service/BUILD.bazel +++ b/python/python-exec-service/BUILD.bazel @@ -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 diff --git a/python/python-exec-service/intellij.python.community.execService.iml b/python/python-exec-service/intellij.python.community.execService.iml index 01408031a1a7..67f480362709 100644 --- a/python/python-exec-service/intellij.python.community.execService.iml +++ b/python/python-exec-service/intellij.python.community.execService.iml @@ -54,5 +54,6 @@ + \ No newline at end of file diff --git a/python/src/com/jetbrains/python/run/target/HelpersAwareTargetEnvironmentRequest.kt b/python/python-exec-service/src/com/jetbrains/python/run/target/HelpersAwareTargetEnvironmentRequest.kt similarity index 93% rename from python/src/com/jetbrains/python/run/target/HelpersAwareTargetEnvironmentRequest.kt rename to python/python-exec-service/src/com/jetbrains/python/run/target/HelpersAwareTargetEnvironmentRequest.kt index e47020ada2c6..c821b02d9335 100644 --- a/python/src/com/jetbrains/python/run/target/HelpersAwareTargetEnvironmentRequest.kt +++ b/python/python-exec-service/src/com/jetbrains/python/run/target/HelpersAwareTargetEnvironmentRequest.kt @@ -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) +@ApiStatus.Internal data class PythonHelpersMappings(val helpers: List) /** @@ -28,22 +31,27 @@ interface HelpersAwareTargetEnvironmentRequest { * helpers scripts. */ @RequiresBackgroundThread + @ApiStatus.Internal fun preparePyCharmHelpers(): PythonHelpersMappings } +@ApiStatus.Internal fun getPythonHelpers(): List = 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): PythonHelpersMappings = PythonHelpersMappings(getPythonHelpers().map { it to targetPathFun }) +@ApiStatus.Internal infix fun Path.to(targetPathFun: TargetEnvironmentFunction): PathMapping = PathMapping(localPath = this, targetPathFun) +@ApiStatus.Internal fun String.tryResolveAsPythonHelperDir(mappings: PythonHelpersMappings): PathMapping? { val thisLocalPath = Path.of(this) val rootPaths = mappings.helpers diff --git a/python/python-exec-service/testResources/intellij.python.community.execService._test.xml b/python/python-exec-service/testResources/intellij.python.community.execService._test.xml index f261a358aa93..d225ce759a33 100644 --- a/python/python-exec-service/testResources/intellij.python.community.execService._test.xml +++ b/python/python-exec-service/testResources/intellij.python.community.execService._test.xml @@ -3,6 +3,7 @@ + diff --git a/python/python-restructuredtext/BUILD.bazel b/python/python-restructuredtext/BUILD.bazel index 043e6fe7c000..14f1ed80b2a0 100644 --- a/python/python-restructuredtext/BUILD.bazel +++ b/python/python-restructuredtext/BUILD.bazel @@ -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", diff --git a/python/python-restructuredtext/intellij.restructuredtext.python.iml b/python/python-restructuredtext/intellij.restructuredtext.python.iml index 061eb4c88c3f..f74b16531a5f 100644 --- a/python/python-restructuredtext/intellij.restructuredtext.python.iml +++ b/python/python-restructuredtext/intellij.restructuredtext.python.iml @@ -31,5 +31,6 @@ + \ No newline at end of file diff --git a/python/python-restructuredtext/resources/intellij.restructuredtext.python.xml b/python/python-restructuredtext/resources/intellij.restructuredtext.python.xml index b80e5f492b53..d2a8b13750f5 100644 --- a/python/python-restructuredtext/resources/intellij.restructuredtext.python.xml +++ b/python/python-restructuredtext/resources/intellij.restructuredtext.python.xml @@ -1,6 +1,7 @@ +