Skip to content

Commit

Permalink
Merge pull request #21132 from mrclary/env-cleanup
Browse files Browse the repository at this point in the history
PR: Don't write to shell history file when getting user environment variables
  • Loading branch information
ccordoba12 authored Jul 15, 2023
2 parents c116c0a + 8ed66f2 commit 3042317
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
20 changes: 0 additions & 20 deletions spyder/plugins/ipythonconsole/utils/kernelspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,6 @@ def is_different_interpreter(pyexec):
return directory_validation and executable_validation


def get_activation_script(quote=False):
"""
Return path for bash/batch conda activation script to run spyder-kernels.
If `quote` is True, then quotes are added if spaces are found in the path.
"""
scripts_folder_path = os.path.join(os.path.dirname(HERE), 'scripts')
if os.name == 'nt':
script = 'conda-activate.bat'
else:
script = 'conda-activate.sh'

script_path = os.path.join(scripts_folder_path, script)

if quote:
script_path = add_quotes(script_path)

return script_path


def has_spyder_kernels(pyexec):
"""Check if env has spyder kernels."""
return is_module_installed(
Expand Down
6 changes: 3 additions & 3 deletions spyder/utils/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def _get_user_env_script():
if Path(shell).name in ('bash', 'zsh'):
script_text = (
f"#!{shell} -i\n"
f"{shell} -l -c"
f" \"{sys.executable} -c 'import os; print(dict(os.environ))'\" "
f"\n"
"unset HISTFILE\n"
f"{shell} -l -c "
f"\"{sys.executable} -c 'import os; print(dict(os.environ))'\"\n"
)
else:
logger.info("Getting user environment variables is not supported "
Expand Down

0 comments on commit 3042317

Please sign in to comment.