From 05b8bdbbb1c9ac4abb88b7aaca6655b0baf8fbc2 Mon Sep 17 00:00:00 2001 From: Alexey Katsman Date: Wed, 4 Mar 2026 17:42:24 +0100 Subject: [PATCH] PY-88045 Do not drop old exe for targets with run tool This option was an experiment (mostly for "uv run") when we tried to use interpreterPath in SDK as a path to uv, but it was dropped later on, so this parameter should've been dropped as well, but it wasn't. (cherry picked from commit 0226eb031c7e0c69c35c19581e915bd13d4fc3c9) IJ-MR-194626 GitOrigin-RevId: 61a8046caa1a522be5e4a278e3d41541dd27213c --- python/src/com/jetbrains/python/run/PythonScripts.kt | 3 +-- .../src/com/jetbrains/python/run/features/PyRunToolProvider.kt | 2 -- .../src/com/jetbrains/python/sdk/uv/run/UvRunToolProvider.kt | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/python/src/com/jetbrains/python/run/PythonScripts.kt b/python/src/com/jetbrains/python/run/PythonScripts.kt index 6a0d85a1cbe4..074be96bc640 100644 --- a/python/src/com/jetbrains/python/run/PythonScripts.kt +++ b/python/src/com/jetbrains/python/run/PythonScripts.kt @@ -16,7 +16,6 @@ import com.intellij.execution.target.TargetEnvironmentRequest import com.intellij.execution.target.TargetPlatform import com.intellij.execution.target.TargetedCommandLine import com.intellij.execution.target.TargetedCommandLineBuilder -import com.intellij.execution.target.getTargetPaths import com.intellij.execution.target.local.LocalTargetPtyOptions import com.intellij.execution.target.value.TargetEnvironmentFunction import com.intellij.execution.target.value.TargetValue @@ -137,7 +136,7 @@ private fun applyRunToolAsync( .onSuccess { originalExe: String? -> commandLineBuilder.exePath = TargetValue.fixed(runTool.exe) commandLineBuilder.addFixedParametersAt(0, runTool.args) - if (!runTool.dropOldExe && originalExe != null) { + if (originalExe != null) { commandLineBuilder.addParameterAt(runTool.args.size, originalExe) } } diff --git a/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt b/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt index cc43da7685c3..38c3b6a2c89a 100644 --- a/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt +++ b/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt @@ -44,14 +44,12 @@ data class PyRunToolData( * @property exe The path to the Python executable or script. * @property args A list of arguments to be passed to the executable. * @property envs A map of environment variables to be used during execution. - * @property dropOldExe Since we replace the original exe with a new one, we can drop the old executable altogether with this flag. */ @ApiStatus.Internal data class PyRunToolParameters( val exe: String, val args: List, val envs: Map, - val dropOldExe: Boolean, ) /** diff --git a/python/src/com/jetbrains/python/sdk/uv/run/UvRunToolProvider.kt b/python/src/com/jetbrains/python/sdk/uv/run/UvRunToolProvider.kt index fc46777a9af2..60c009eced22 100644 --- a/python/src/com/jetbrains/python/sdk/uv/run/UvRunToolProvider.kt +++ b/python/src/com/jetbrains/python/sdk/uv/run/UvRunToolProvider.kt @@ -28,7 +28,7 @@ internal class UvRunToolProvider : PyRunToolProvider { env += "VIRTUAL_ENV" to it env += "UV_PROJECT_ENVIRONMENT" to it } - return PyRunToolParameters(requireNotNull(uvExecutable) { "Unable to find uv executable." }, listOf("run"), env, dropOldExe = true) + return PyRunToolParameters(requireNotNull(uvExecutable) { "Unable to find uv executable." }, listOf("run"), env) } override val runToolData: PyRunToolData = PyRunToolData(