mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup [python]: remove unused symbols
GitOrigin-RevId: fbe0990d113825039ca6341860c24915a1493cf7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
22264078bc
commit
d17f8bbe67
@@ -779,8 +779,6 @@
|
||||
<extensionPoint qualifiedName="Pythonid.packageManagerProvider"
|
||||
interface="com.jetbrains.python.packaging.PyPackageManagerProvider"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.sshInterpreterManager" interface="com.jetbrains.python.remote.PythonSshInterpreterManager"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint qualifiedName="Pythonid.condaSdkCustomizer"
|
||||
interface="com.jetbrains.python.sdk.conda.PyCondaSdkCustomizer"
|
||||
|
||||
+1
@@ -131,6 +131,7 @@ internal class PythonLangSupport(private val errorSink: ErrorSink = ShowingMessa
|
||||
}
|
||||
|
||||
private fun showSdkChoosingDialog(existingSdks: List<Sdk>, context: UserDataHolder): Sdk? {
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
val baseSdkField = PySdkPathChoosingComboBox()
|
||||
|
||||
val warningPlaceholder = JLabel()
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @deprecated use {@link com.intellij.execution.process.ProcessListener} directly
|
||||
*/
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public final class IndicatedProcessOutputListener extends ProcessAdapter {
|
||||
private final @NotNull ProgressIndicator myIndicator;
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.python.configuration.EditSdkDialog">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="600" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="a965b" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<labelFor value="bc0d9"/>
|
||||
<text resource-bundle="messages/PyBundle" key="form.edit.sdk.label.create.connection.pool.options.name"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="41b5e">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="bc0d9" class="javax.swing.JTextField" binding="myNameTextField">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="300" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<columns value="100"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f30dd" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/PyBundle" key="form.edit.sdk.interpreter.path"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f2225" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myInterpreterPathTextField">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="6478c" class="com.intellij.ui.components.JBCheckBox" binding="myAssociateCheckbox">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="false"/>
|
||||
<text resource-bundle="messages/PyBundle" key="form.edit.sdk.associate.this.virtual.environment.with.current.project"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8ba78" class="com.intellij.ui.components.JBLabel" binding="myRemoveAssociationLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/PyBundle" key="form.edit.sdk.html.href.remove.association"/>
|
||||
<visible value="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -1,151 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.configuration;
|
||||
|
||||
import com.intellij.execution.target.BrowsableTargetEnvironmentType;
|
||||
import com.intellij.execution.target.TargetBasedSdkAdditionalData;
|
||||
import com.intellij.execution.target.TargetBrowserHints;
|
||||
import com.intellij.execution.target.TargetEnvironmentConfigurationKt;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.SdkAdditionalData;
|
||||
import com.intellij.openapi.projectRoots.SdkModificator;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.TextComponentAccessor;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.ui.ClickListener;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.sdk.PythonSdkAdditionalData;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.VirtualEnvSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.conda.CondaEnvSdkFlavor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
|
||||
public class EditSdkDialog extends DialogWrapper {
|
||||
private JPanel myMainPanel;
|
||||
private JTextField myNameTextField;
|
||||
private TextFieldWithBrowseButton myInterpreterPathTextField;
|
||||
private JBCheckBox myAssociateCheckbox;
|
||||
private JBLabel myRemoveAssociationLabel;
|
||||
private final boolean myWasAssociated;
|
||||
private boolean myAssociationRemoved = false;
|
||||
|
||||
protected EditSdkDialog(Project project, SdkModificator sdk, final NullableFunction<? super String, String> nameValidator) {
|
||||
super(project, true);
|
||||
setTitle(PyBundle.message("sdk.edit.dialog.title"));
|
||||
myNameTextField.setText(sdk.getName());
|
||||
myNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
protected void textChanged(@NotNull DocumentEvent e) {
|
||||
@NlsSafe String nameError = nameValidator.fun(getName());
|
||||
setErrorText(nameError, myNameTextField);
|
||||
setOKActionEnabled(nameError == null);
|
||||
}
|
||||
});
|
||||
final String homePath = sdk.getHomePath();
|
||||
myInterpreterPathTextField.setText(homePath);
|
||||
var sdkAdditionalData = sdk.getSdkAdditionalData();
|
||||
var label = PyBundle.message("sdk.edit.dialog.specify.interpreter.path");
|
||||
var targetListener = createBrowseTargetListener(project, sdkAdditionalData, label);
|
||||
if (targetListener != null) {
|
||||
myInterpreterPathTextField.addActionListener(targetListener);
|
||||
}
|
||||
else {
|
||||
myInterpreterPathTextField.addBrowseFolderListener(project, PythonSdkType.getInstance().getHomeChooserDescriptor().withTitle(label));
|
||||
}
|
||||
myRemoveAssociationLabel.setVisible(false);
|
||||
final PythonSdkFlavor sdkFlavor = PythonSdkFlavor.getPlatformIndependentFlavor(homePath);
|
||||
if ((sdkFlavor instanceof VirtualEnvSdkFlavor) || (sdkFlavor instanceof CondaEnvSdkFlavor)) {
|
||||
PythonSdkAdditionalData data = (PythonSdkAdditionalData)sdk.getSdkAdditionalData();
|
||||
if (data != null) {
|
||||
final String path = data.getAssociatedModulePath();
|
||||
if (path != null) {
|
||||
myAssociateCheckbox.setSelected(true);
|
||||
final String basePath = project.getBasePath();
|
||||
if (basePath != null && !path.equals(FileUtil.toSystemIndependentName(basePath))) {
|
||||
myAssociateCheckbox.setEnabled(false);
|
||||
myAssociateCheckbox.setText(PyBundle.message("sdk.edit.dialog.associate.virtual.env.with.path",
|
||||
FileUtil.toSystemDependentName(path)));
|
||||
myRemoveAssociationLabel.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
myAssociateCheckbox.setVisible(false);
|
||||
}
|
||||
myWasAssociated = myAssociateCheckbox.isSelected();
|
||||
init();
|
||||
new ClickListener() {
|
||||
@Override
|
||||
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
|
||||
myAssociateCheckbox.setSelected(false);
|
||||
myAssociateCheckbox.setEnabled(true);
|
||||
myAssociateCheckbox.setText(PyBundle.message("sdk.edit.dialog.associate.virtual.env.current.project"));
|
||||
myRemoveAssociationLabel.setVisible(false);
|
||||
myAssociationRemoved = true;
|
||||
return true;
|
||||
}
|
||||
}.installOn(myRemoveAssociationLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return action to call when user clicks on "browse" button if sdk is target SDK that supports browsing
|
||||
*/
|
||||
private @Nullable ActionListener createBrowseTargetListener(@NotNull Project project, @NotNull SdkAdditionalData sdkAdditionalData,
|
||||
@NotNull @NlsContexts.DialogTitle String label) {
|
||||
if (!(sdkAdditionalData instanceof TargetBasedSdkAdditionalData)) {
|
||||
return null;
|
||||
}
|
||||
var configuration = ((TargetBasedSdkAdditionalData)sdkAdditionalData).getTargetEnvironmentConfiguration();
|
||||
if (configuration != null) {
|
||||
var type = TargetEnvironmentConfigurationKt.getTargetType(configuration);
|
||||
if (type instanceof BrowsableTargetEnvironmentType) {
|
||||
return ((BrowsableTargetEnvironmentType)type).createBrowser(project, label, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
|
||||
myInterpreterPathTextField.getTextField(), () -> configuration, new TargetBrowserHints(true, null));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
return myMainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myNameTextField;
|
||||
}
|
||||
|
||||
public @NlsSafe String getName() {
|
||||
return myNameTextField.getText();
|
||||
}
|
||||
|
||||
public String getHomePath() {
|
||||
return myInterpreterPathTextField.getText();
|
||||
}
|
||||
|
||||
public boolean associateWithProject() {
|
||||
return myAssociateCheckbox.isSelected();
|
||||
}
|
||||
|
||||
public boolean isAssociateChanged() {
|
||||
return myWasAssociated != associateWithProject() || myAssociationRemoved;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,6 @@ public class PyIntegratedToolsConfigurable implements SearchableConfigurable {
|
||||
private JComboBox<PyAbstractTestFactory<?>> myTestRunnerComboBox;
|
||||
private JComboBox<DocStringFormat> myDocstringFormatComboBox;
|
||||
private PyTestRunConfigurationsModel myModel;
|
||||
private final PyPackageRequirementsSettings myPackagingSettings;
|
||||
private final @Nullable Module myModule;
|
||||
private final @NotNull Project myProject;
|
||||
private final PyDocumentationSettings myDocumentationSettings;
|
||||
@@ -104,7 +103,7 @@ public class PyIntegratedToolsConfigurable implements SearchableConfigurable {
|
||||
myModule = module;
|
||||
myProject = project;
|
||||
myDocumentationSettings = PyDocumentationSettings.getInstance(myModule);
|
||||
myPackagingSettings = PyPackageRequirementsSettings.getInstance(module);
|
||||
PyPackageRequirementsSettings packagingSettings = PyPackageRequirementsSettings.getInstance(module);
|
||||
myDocstringFormatComboBox.setModel(new CollectionComboBoxModel<>(new ArrayList<>(Arrays.asList(DocStringFormat.values())),
|
||||
myDocumentationSettings.getFormat()));
|
||||
myDocstringFormatComboBox.setRenderer(SimpleListCellRenderer.create("", DocStringFormat::getName));
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.jetbrains.python.sdk.flavors.conda.CondaEnvSdkFlavor
|
||||
/**
|
||||
* Configurable for local Python interpreter.
|
||||
*
|
||||
* Replaces [EditSdkDialog].
|
||||
*/
|
||||
class PythonLocalInterpreterConfigurable(private val project: Project, private val module: Module?, private val sdk: Sdk)
|
||||
: BoundConfigurable(sdk.name) {
|
||||
|
||||
@@ -67,17 +67,6 @@ public class PythonPathEditor extends SdkPathEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void reload(@Nullable SdkModificator sdkModificator) {
|
||||
if (sdkModificator != null) {
|
||||
List<VirtualFile> list = ImmutableList.copyOf(sdkModificator.getRoots(getOrderRootType()));
|
||||
resetPath(myPathListModel.reload(list));
|
||||
setModified(true);
|
||||
}
|
||||
else {
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(SdkModificator sdkModificator) {
|
||||
sdkModificator.removeRoots(getOrderRootType());
|
||||
@@ -152,7 +141,6 @@ public class PythonPathEditor extends SdkPathEditor {
|
||||
private final List<VirtualFile> myFilteredOut = new ArrayList<>();
|
||||
private final DefaultListModel<VirtualFile> myListModel;
|
||||
private final OrderRootType myOrderRootType;
|
||||
private final Set<VirtualFile> myUserAddedToRemove = new HashSet<>();
|
||||
|
||||
PathListModel(OrderRootType orderRootType, DefaultListModel<VirtualFile> listModel) {
|
||||
myOrderRootType = orderRootType;
|
||||
@@ -172,7 +160,6 @@ public class PythonPathEditor extends SdkPathEditor {
|
||||
if (!myFoundFiles.contains(file)) {
|
||||
if (!myExcluded.remove(file)) { //if it was excluded we only delete exclusion mark
|
||||
myAdded.add(file);
|
||||
myUserAddedToRemove.remove(file);
|
||||
}
|
||||
else {
|
||||
myFoundFiles.add(file);
|
||||
@@ -192,7 +179,6 @@ public class PythonPathEditor extends SdkPathEditor {
|
||||
if (myAdded.contains(e.first)) {
|
||||
toRemove.add(e.second);
|
||||
myAdded.remove(e.first);
|
||||
myUserAddedToRemove.add(e.first);
|
||||
}
|
||||
else if (myExcluded.contains(e.first)) {
|
||||
myExcluded.remove(e.first);
|
||||
@@ -243,23 +229,12 @@ public class PythonPathEditor extends SdkPathEditor {
|
||||
return "";
|
||||
}
|
||||
|
||||
public @NotNull List<VirtualFile> reload(@NotNull List<VirtualFile> list) {
|
||||
myFoundFiles.clear();
|
||||
myFoundFiles.addAll(list);
|
||||
List<VirtualFile> result = filterOutStubs(list, myFilteredOut);
|
||||
result.removeAll(myUserAddedToRemove);
|
||||
result.addAll(myAdded);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public @NotNull List<VirtualFile> reset(@NotNull List<VirtualFile> list, @NotNull SdkModificator modificator) {
|
||||
myFilteredOut.clear();
|
||||
List<VirtualFile> result = filterOutStubs(list, myFilteredOut);
|
||||
|
||||
myFoundFiles.clear();
|
||||
myFoundFiles.addAll(list);
|
||||
myUserAddedToRemove.clear();
|
||||
|
||||
if (modificator.getSdkAdditionalData() instanceof PythonSdkAdditionalData data) {
|
||||
setAdded(data.getAddedPathFiles());
|
||||
|
||||
@@ -154,6 +154,7 @@ public abstract class PyAbstractPackageCache {
|
||||
public PackageInfo() {
|
||||
}
|
||||
|
||||
|
||||
public @Nullable List<String> getVersions() {
|
||||
return myVersions != null ? Collections.unmodifiableList(myVersions) : null;
|
||||
}
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.packaging.conda.environmentYml
|
||||
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.FilesModificationTrackerBase
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
internal class CondaEnvYamlModificationTracker(project: Project) : FilesModificationTrackerBase(project) {
|
||||
override fun isFileSupported(virtualFile: VirtualFile): Boolean {
|
||||
return virtualFile.name in setOf(CondaEnvironmentYmlSdkUtils.ENV_YML_FILE_NAME, CondaEnvironmentYmlSdkUtils.ENV_YAML_FILE_NAME)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project): CondaEnvYamlModificationTracker {
|
||||
return project.service()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.packaging.setupPy
|
||||
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.FilesModificationTrackerBase
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
internal class SetupPyModificationTracker(project: Project) : FilesModificationTrackerBase(project) {
|
||||
override fun isFileSupported(virtualFile: VirtualFile): Boolean = virtualFile.name == SetupPyHelpers.SETUP_PY
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project): SetupPyModificationTracker = project.service()
|
||||
}
|
||||
}
|
||||
@@ -1,85 +1,19 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.remote;
|
||||
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.ParamsGroup;
|
||||
import com.intellij.remote.RemoteFile;
|
||||
import com.intellij.remote.RemoteProcessUtil;
|
||||
import com.intellij.util.PathMapper;
|
||||
import com.jetbrains.python.debugger.PyDebugRunner;
|
||||
import com.jetbrains.python.run.PythonCommandLineState;
|
||||
import com.jetbrains.python.sdk.PythonEnvUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
public final class PyCommandLineStateUtil {
|
||||
// the environment variable used by BDD to hold a set of folder or feature files
|
||||
private static final String PY_STUFF_TO_RUN = "PY_STUFF_TO_RUN";
|
||||
|
||||
private PyCommandLineStateUtil() { }
|
||||
|
||||
public static void remap(@NotNull String interpreterPath, @NotNull GeneralCommandLine commandLine, @NotNull PathMapper pathMapper) {
|
||||
ParamsGroup paramsGroup = commandLine.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
|
||||
remapParameters(interpreterPath, pathMapper, paramsGroup, commandLine.getWorkDirectory());
|
||||
|
||||
remapEnvPaths(commandLine.getEnvironment(), pathMapper, interpreterPath, PythonEnvUtil.PYTHONPATH);
|
||||
remapEnvPaths(commandLine.getEnvironment(), pathMapper, interpreterPath, PyDebugRunner.IDE_PROJECT_ROOTS);
|
||||
remapEnvStuffPaths(commandLine.getEnvironment(), pathMapper, interpreterPath, PY_STUFF_TO_RUN);
|
||||
}
|
||||
|
||||
public static void remapParameters(
|
||||
@NotNull String interpreterPath,
|
||||
@NotNull PathMapper pathMapper,
|
||||
@Nullable ParamsGroup paramsGroup,
|
||||
@Nullable File workDirectory
|
||||
) {
|
||||
if (paramsGroup != null) {
|
||||
if (!paramsGroup.getParameters().isEmpty()) {
|
||||
makeParamAbsoluteIfRelative(paramsGroup, 0, workDirectory);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
boolean isWin = RemoteFile.isWindowsPath(interpreterPath);
|
||||
for (String param : paramsGroup.getParameters()) {
|
||||
if (pathMapper.canReplaceLocal(param)) {
|
||||
paramsGroup.getParametersList().set(i++, RemoteFile.createRemoteFile(pathMapper.convertToRemote(param), isWin).getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void makeParamAbsoluteIfRelative(ParamsGroup paramsGroup, int paramIndex, @Nullable File workDirectory) {
|
||||
String param = paramsGroup.getParameters().get(paramIndex);
|
||||
if (!new File(param).isAbsolute() && workDirectory != null) {
|
||||
File paramFile = new File(workDirectory, param);
|
||||
if (paramFile.exists()) {
|
||||
paramsGroup.getParametersList().set(paramIndex, paramFile.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void remapEnvPaths(Map<String, String> env, PathMapper pathMapper, String interpreterPath, String envKey) {
|
||||
if (env.isEmpty()) return;
|
||||
|
||||
String envPaths = env.get(envKey);
|
||||
if (envPaths != null) {
|
||||
env.put(envKey, RemoteProcessUtil.remapPathsList(envPaths, pathMapper, interpreterPath));
|
||||
}
|
||||
}
|
||||
|
||||
private static void remapEnvStuffPaths(Map<String, String> env, PathMapper pathMapper, String interpreterPath, String envKey) {
|
||||
String envPaths = env.get(envKey);
|
||||
if (envPaths != null) {
|
||||
env.put(envKey, remapStuffPathsList(envPaths, pathMapper, interpreterPath));
|
||||
}
|
||||
}
|
||||
|
||||
public static @NotNull String remapStuffPathsList(@NotNull String pathsValue, @NotNull PathMapper pathMapper, @NotNull String interpreterPath) {
|
||||
boolean isWin = RemoteFile.isWindowsPath(interpreterPath);
|
||||
|
||||
@@ -60,6 +60,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
|
||||
return myPathMapper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Pair<String, Integer> getRemoteSocket(int localPort) throws RemoteSdkException {
|
||||
try {
|
||||
@@ -70,6 +71,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @Nullable HostAndPort getLocalTunnel(int remotePort) {
|
||||
return myProcess.getLocalTunnel(remotePort);
|
||||
@@ -87,6 +89,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static @NotNull PyRemoteProcessHandler createProcessHandler(@NotNull RemoteProcess remoteProcess,
|
||||
@NotNull String commandLine,
|
||||
@NotNull Charset charset,
|
||||
@@ -153,6 +156,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
|
||||
return myFileMappings;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull PyPositionConverter createPositionConverter(@NotNull PyDebugProcess debugProcess) {
|
||||
return new PyRemotePositionConverter(debugProcess, myPathMapper);
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.remote;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* This service provides functionality for SSH remote interpreters. It is
|
||||
* expected to be implemented in Python SSH Interpreter plugin using the
|
||||
* extension point {@link #EP_NAME}.
|
||||
*/
|
||||
public interface PythonSshInterpreterManager {
|
||||
Logger LOG = Logger.getInstance(PythonSshInterpreterManager.class);
|
||||
|
||||
ExtensionPointName<PythonSshInterpreterManager> EP_NAME = ExtensionPointName.create("Pythonid.sshInterpreterManager");
|
||||
|
||||
final class Factory {
|
||||
public static @Nullable PythonSshInterpreterManager getInstance() {
|
||||
var extensions = EP_NAME.getExtensionList();
|
||||
return switch (extensions.size()) {
|
||||
case 0 -> {
|
||||
LOG.debug(MessageFormat.format("Extension for ''{0}'' extension point is absent", EP_NAME.getName()));
|
||||
yield null;
|
||||
}
|
||||
case 1 -> extensions.get(0);
|
||||
default -> {
|
||||
LOG.error(MessageFormat.format("Several extensions registered for ''{0}'' extension point", EP_NAME.getName()));
|
||||
yield null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -443,6 +443,7 @@ public final class PythonSdkUpdater {
|
||||
* @see #updateVersionAndPathsSynchronouslyAndScheduleRemaining(Sdk, Project)
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
|
||||
public static void updateOrShowError(@NotNull Sdk sdk, @Nullable Project project, @Nullable Component ownerComponent) {
|
||||
boolean versionAndPathsUpdated = updateVersionAndPathsSynchronouslyAndScheduleRemaining(sdk, project);
|
||||
if (!versionAndPathsUpdated) {
|
||||
|
||||
@@ -18,15 +18,15 @@ import javax.swing.JPanel
|
||||
"Custom Python SDKs support was removed from python plugin for IDEA because of UI/UX unification with PyCharm",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
class PyAddSdkGroupPanel(private val nameGetter: Supplier<@Nls String>,
|
||||
class PyAddSdkGroupPanel @Suppress("DEPRECATION_ERROR") constructor(private val nameGetter: Supplier<@Nls String>,
|
||||
|
||||
panelIcon: Icon,
|
||||
val panels: List<PyAddSdkPanel>,
|
||||
defaultPanel: PyAddSdkPanel
|
||||
) : PyAddSdkPanel() {
|
||||
) : @Suppress("DEPRECATION_ERROR") PyAddSdkPanel() {
|
||||
override val panelName: String get() = nameGetter.get() // NON-NLS
|
||||
override val icon: Icon = panelIcon
|
||||
var selectedPanel: PyAddSdkPanel = defaultPanel
|
||||
var selectedPanel: @Suppress("DEPRECATION_ERROR") PyAddSdkPanel = defaultPanel
|
||||
private val changeListeners: MutableList<Runnable> = mutableListOf()
|
||||
|
||||
override var newProjectPath: String?
|
||||
@@ -59,7 +59,7 @@ class PyAddSdkGroupPanel(private val nameGetter: Supplier<@Nls String>,
|
||||
panel.addChangeListener(listener)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
private fun createRadioButtonPanel(panels: List<PyAddSdkPanel>, defaultPanel: PyAddSdkPanel): JPanel {
|
||||
val buttonMap = panels.map { JBRadioButton(it.panelName) to it }.toMap(linkedMapOf())
|
||||
ButtonGroup().apply {
|
||||
|
||||
@@ -38,9 +38,11 @@ abstract class PyAddSdkPanel : JPanel(), PyAddSdkView {
|
||||
*/
|
||||
@Deprecated(
|
||||
message ="this ComboBox was designed only for plain venv, not tool-specific pythons and doesn't supported anymore",
|
||||
replaceWith = ReplaceWith("PythonInterpreterComboBox")
|
||||
replaceWith = ReplaceWith("PythonInterpreterComboBox"),
|
||||
DeprecationLevel.ERROR
|
||||
)
|
||||
fun addInterpretersAsync(
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
sdkComboBox: PySdkPathChoosingComboBox,
|
||||
sdkObtainer: () -> List<Sdk>,
|
||||
onAdded: (List<Sdk>) -> Unit,
|
||||
|
||||
@@ -82,7 +82,6 @@ private class PySdkListCellRendererExt : ListCellRenderer<PySdkComboBoxItem> {
|
||||
* A combobox with browse button for choosing a path to SDK, also capable of showing progress indicator.
|
||||
* To toggle progress indicator visibility use [setBusy] method.
|
||||
*
|
||||
* To fill this box in async mode use [addInterpretersToComboAsync]
|
||||
*
|
||||
*/
|
||||
@Deprecated(
|
||||
@@ -196,7 +195,8 @@ class PySdkPathChoosingComboBox @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
class PySdkComboBoxTextAccessor(private val targetEnvironmentConfiguration: TargetEnvironmentConfiguration?) : TextComponentAccessor<JComboBox<PySdkComboBoxItem>> {
|
||||
class PySdkComboBoxTextAccessor(private val targetEnvironmentConfiguration: TargetEnvironmentConfiguration?) :
|
||||
TextComponentAccessor<JComboBox<PySdkComboBoxItem>> {
|
||||
override fun getText(component: JComboBox<PySdkComboBoxItem>): String =
|
||||
(component.selectedItem as? ExistingPySdkComboBoxItem)?.getText().orEmpty()
|
||||
|
||||
@@ -217,17 +217,11 @@ class PySdkPathChoosingComboBox @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a list of sdk on a pool using [sdkObtainer], then fills [sdkComboBox] on the EDT.
|
||||
*/
|
||||
internal fun addInterpretersToComboAsync(sdkComboBox: PySdkPathChoosingComboBox, sdkObtainer: () -> List<Sdk>) {
|
||||
addInterpretersToComboAsync(sdkComboBox, sdkObtainer, {})
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a list of sdk on a pool using [sdkObtainer], then fills [sdkComboBox] and calls [onAdded] on the EDT.
|
||||
*/
|
||||
internal fun addInterpretersToComboAsync(
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
sdkComboBox: PySdkPathChoosingComboBox,
|
||||
sdkObtainer: () -> List<Sdk>,
|
||||
onAdded: (List<Sdk>) -> Unit,
|
||||
@@ -253,6 +247,8 @@ internal fun addInterpretersToComboAsync(
|
||||
/**
|
||||
* Keeps [NewPySdkComboBoxItem] if it is present in the combobox.
|
||||
*/
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
private fun PySdkPathChoosingComboBox.removeAllItems() {
|
||||
if (childComponent.itemCount > 0 && childComponent.getItemAt(0) is NewPySdkComboBoxItem) {
|
||||
while (childComponent.itemCount > 1) {
|
||||
@@ -270,7 +266,8 @@ private fun PySdkPathChoosingComboBox.removeAllItems() {
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
fun addBaseInterpretersAsync(
|
||||
sdkComboBox: PySdkPathChoosingComboBox,
|
||||
sdkComboBox: @Suppress("DEPRECATION_ERROR") PySdkPathChoosingComboBox,
|
||||
|
||||
existingSdks: List<Sdk>,
|
||||
module: Module?,
|
||||
context: UserDataHolder,
|
||||
|
||||
Reference in New Issue
Block a user