mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python] PY-50890 unconditionally set UTF-8 as helpers charset
Space-RevId: 65d7fdde6dc16d89d9964a6c26645820c315ac2d (cherry picked from commit 0e08e507fc1d3dc84b4598f29ef40588291fc54d) IJ-MR-189020 GitOrigin-RevId: 0d62e6388021eb4436b3c213479e52d736143077
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b54512198d
commit
1c239549f2
@@ -38,6 +38,7 @@ import com.jetbrains.python.run.features.PyRunToolParameters
|
||||
import com.jetbrains.python.run.target.HelpersAwareTargetEnvironmentRequest
|
||||
import com.jetbrains.python.run.target.PathMapping
|
||||
import com.jetbrains.python.run.target.tryResolveAsPythonHelperDir
|
||||
import com.jetbrains.python.sdk.PythonEnvUtil
|
||||
import com.jetbrains.python.sdk.PythonSdkType
|
||||
import com.jetbrains.python.sdk.configureBuilderToRunPythonOnTarget
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor
|
||||
@@ -47,10 +48,10 @@ import com.jetbrains.python.target.PyTargetAwareAdditionalData.Companion.pathsAd
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.pathString
|
||||
import kotlin.text.Charsets.UTF_8
|
||||
|
||||
private val LOG = Logger.getInstance("#com.jetbrains.python.run.PythonScripts")
|
||||
|
||||
|
||||
@JvmOverloads
|
||||
@ApiStatus.Internal
|
||||
fun PythonExecution.buildTargetedCommandLine(
|
||||
@@ -166,12 +167,18 @@ private fun resolveUploadPath(localPath: String, uploads: List<PathMapping>): Ta
|
||||
return upload.targetPathFun.getRelativeTargetPath(localRelativePath)
|
||||
}
|
||||
|
||||
private fun PythonExecution.setHelpersCharset() {
|
||||
charset = UTF_8
|
||||
addEnvironmentVariable(PythonEnvUtil.PYTHONIOENCODING, UTF_8.name())
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun prepareHelperScriptExecution(helperPackage: HelperPackage,
|
||||
helpersAwareTargetRequest: HelpersAwareTargetEnvironmentRequest): PythonScriptExecution =
|
||||
PythonScriptExecution().apply {
|
||||
val uploads = applyHelperPackageToPythonPath(helperPackage, helpersAwareTargetRequest)
|
||||
pythonScriptPath = resolveUploadPath(helperPackage.asParamString(), uploads)
|
||||
setHelpersCharset()
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -188,8 +195,9 @@ fun prepareHelperScriptViaToolExecution(
|
||||
toolParams,
|
||||
resolveUploadPath(helperPackage.asParamString(), uploads).andThen { Path.of(it) }
|
||||
)
|
||||
execution.envs += envs;
|
||||
return execution;
|
||||
execution.envs += envs
|
||||
execution.setHelpersCharset()
|
||||
return execution
|
||||
}
|
||||
|
||||
private const val PYTHONPATH_ENV = "PYTHONPATH"
|
||||
|
||||
Reference in New Issue
Block a user