mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 02:38:59 +07:00
Python: Introduce functions to call code against SDK:
See `sdkExecApi.kt` GitOrigin-RevId: 0014b607ee6efa058e9144cfb208c7e75dff1e47
This commit is contained in:
committed by
intellij-monorepo-bot
parent
030246de49
commit
12960161ff
@@ -4,8 +4,8 @@ package com.intellij.python.community.execService.python.advancedApi
|
||||
import com.intellij.python.community.execService.*
|
||||
import com.intellij.python.community.execService.impl.transformerToHandler
|
||||
import com.intellij.python.community.execService.python.HelperName
|
||||
import com.intellij.python.community.execService.python.addHelper
|
||||
import com.intellij.python.community.execService.python.impl.validatePythonAndGetVersionImpl
|
||||
import com.intellij.python.community.helpersLocator.PythonHelpersLocator
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import com.jetbrains.python.psi.LanguageLevel
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
@@ -23,7 +23,7 @@ suspend fun <T> ExecService.executePythonAdvanced(
|
||||
): PyResult<T> =
|
||||
executeAdvanced(
|
||||
binary = BinOnEel(python.binary),
|
||||
args = Args(*python.args.toTypedArray()) + args,
|
||||
args = Args(*python.args.toTypedArray()).add(args),
|
||||
// TODO: Merge PATH
|
||||
options = options.copy(env = options.env + python.env), processInteractiveHandler)
|
||||
|
||||
@@ -40,10 +40,7 @@ suspend fun <T> ExecService.executeHelperAdvanced(
|
||||
processOutputTransformer: ProcessOutputTransformer<T>,
|
||||
): PyResult<T> = executePythonAdvanced(
|
||||
python,
|
||||
Args().apply {
|
||||
addLocalFile(PythonHelpersLocator.findPathInHelpers(helper))
|
||||
addArgs(*args.toTypedArray())
|
||||
},
|
||||
Args().addHelper(helper).addArgs(args),
|
||||
options, transformerToHandler(procListener, processOutputTransformer))
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.execService.python
|
||||
|
||||
import com.intellij.python.community.execService.Args
|
||||
import com.intellij.python.community.execService.ExecOptions
|
||||
import com.intellij.python.community.execService.ExecService
|
||||
import com.intellij.python.community.execService.PyProcessListener
|
||||
@@ -8,6 +9,7 @@ import com.intellij.python.community.execService.ZeroCodeStdoutTransformer
|
||||
import com.intellij.python.community.execService.python.advancedApi.ExecutablePython
|
||||
import com.intellij.python.community.execService.python.advancedApi.executeHelperAdvanced
|
||||
import com.intellij.python.community.execService.python.advancedApi.validatePythonAndGetVersion
|
||||
import com.intellij.python.community.helpersLocator.PythonHelpersLocator
|
||||
import com.jetbrains.python.PythonBinary
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import com.jetbrains.python.psi.LanguageLevel
|
||||
@@ -36,4 +38,11 @@ suspend fun ExecService.executeHelper(
|
||||
suspend fun ExecService.validatePythonAndGetVersion(python: PythonBinary): PyResult<LanguageLevel> =
|
||||
validatePythonAndGetVersion(ExecutablePython.vanillaExecutablePython(python))
|
||||
|
||||
suspend fun PythonBinary.validatePythonAndGetVersion(): PyResult<LanguageLevel> = ExecService().validatePythonAndGetVersion(this)
|
||||
suspend fun PythonBinary.validatePythonAndGetVersion(): PyResult<LanguageLevel> = ExecService().validatePythonAndGetVersion(this)
|
||||
|
||||
|
||||
/**
|
||||
* Adds helper by copying it to the remote system (if needed)
|
||||
*/
|
||||
fun Args.addHelper(helper: HelperName): Args =
|
||||
addLocalFile(PythonHelpersLocator.findPathInHelpers(helper))
|
||||
Reference in New Issue
Block a user