Skip to content

Commit

Permalink
Merge from 5.x: PR #21783
Browse files Browse the repository at this point in the history
Fixes #21749
  • Loading branch information
ccordoba12 committed Feb 9, 2024
2 parents 22f7e56 + 75e5b60 commit 89475f7
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions spyder/plugins/ipythonconsole/utils/kernelspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import logging
import os
import os.path as osp
import sys

# Third party imports
from jupyter_client.kernelspec import KernelSpec
Expand Down Expand Up @@ -56,16 +55,6 @@
"</pre>")


def is_different_interpreter(pyexec):
"""Check that pyexec is a different interpreter from sys.executable."""
# Paths may be symlinks
real_pyexe = osp.realpath(pyexec)
real_sys_exe = osp.realpath(sys.executable)
executable_validation = osp.basename(real_pyexe).startswith('python')
directory_validation = osp.dirname(real_pyexe) != osp.dirname(real_sys_exe)
return directory_validation and executable_validation


def has_spyder_kernels(pyexec):
"""Check if env has spyder kernels."""
if is_module_installed(
Expand Down Expand Up @@ -127,9 +116,6 @@ def argv(self):
self.set_conf('default', True, section='main_interpreter')
self.set_conf('custom', False, section='main_interpreter')

# Part of spyder-ide/spyder#11819
is_different = is_different_interpreter(pyexec)

# Command used to start kernels
kernel_cmd = [
pyexec,
Expand All @@ -140,7 +126,7 @@ def argv(self):
'-f', '{connection_file}'
]

if is_different and is_conda_env(pyexec=pyexec):
if is_conda_env(pyexec=pyexec):
# If executable is a conda environment and different from Spyder's
# runtime environment, we need to activate the environment to run
# spyder-kernels
Expand Down

0 comments on commit 89475f7

Please sign in to comment.