"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "conda/core/initialize.py" between
conda-4.6.2.tar.gz and conda-4.6.3.tar.gz

About: Conda is a cross-platform, language-agnostic, system-level binary package manager and ecosystem.

initialize.py  (conda-4.6.2):initialize.py  (conda-4.6.3)
skipping to change at line 465 skipping to change at line 465
if for_system: if for_system:
raise NotImplementedError() raise NotImplementedError()
if 'tcsh' in shells: if 'tcsh' in shells:
if for_user: if for_user:
raise NotImplementedError() raise NotImplementedError()
if for_system: if for_system:
raise NotImplementedError() raise NotImplementedError()
if 'powershell' in shells: if 'powershell' in shells:
if for_user:
profile = '$PROFILE.CurrentUserAllHosts'
if for_system:
profile = '$PROFILE.AllUsersAllHosts'
# There's several places PowerShell can store its path, depending # There's several places PowerShell can store its path, depending
# on if it's Windows PowerShell, PowerShell Core on Windows, or # on if it's Windows PowerShell, PowerShell Core on Windows, or
# PowerShell Core on macOS/Linux. The easiest way to resolve it is to # PowerShell Core on macOS/Linux. The easiest way to resolve it is to
# just ask different possible installations of PowerShell where their # just ask different possible installations of PowerShell where their
# profiles are. # profiles are.
def find_powershell_paths(*exe_names): def find_powershell_paths(*exe_names):
for exe_name in exe_names: for exe_name in exe_names:
try: try:
yield subprocess_call( yield subprocess_call(
(exe_name, '-NoProfile', '-Command', '$PROFILE') (exe_name, '-NoProfile', '-Command', profile)
).stdout.strip() ).stdout.strip()
except Exception: except Exception:
pass pass
config_powershell_paths = tuple( config_powershell_paths = set(
find_powershell_paths('powershell', 'pwsh', 'pwsh-preview') find_powershell_paths('powershell', 'pwsh', 'pwsh-preview')
) )
for config_path in config_powershell_paths: for config_path in config_powershell_paths:
if config_path is not None: if config_path is not None:
plan.append({ plan.append({
'function': init_powershell_user.__name__, 'function': init_powershell_user.__name__,
'kwargs': { 'kwargs': {
'target_path': config_path, 'target_path': config_path,
'conda_prefix': conda_prefix 'conda_prefix': conda_prefix
} }
}) })
if for_system:
raise NotImplementedError(
"PowerShell hooks are only implemented for per-user profiles."
)
if 'cmd.exe' in shells: if 'cmd.exe' in shells:
if for_user: if for_user:
plan.append({ plan.append({
'function': init_cmd_exe_registry.__name__, 'function': init_cmd_exe_registry.__name__,
'kwargs': { 'kwargs': {
'target_path': 'HKEY_CURRENT_USER\\Software\\Microsoft\\' 'target_path': 'HKEY_CURRENT_USER\\Software\\Microsoft\\'
'Command Processor\\AutoRun', 'Command Processor\\AutoRun',
'conda_prefix': conda_prefix, 'conda_prefix': conda_prefix,
}, },
}) })
skipping to change at line 1209 skipping to change at line 1210
def _powershell_profile_content(conda_prefix): def _powershell_profile_content(conda_prefix):
if on_win: if on_win:
conda_exe = join(conda_prefix, 'Scripts', 'conda.exe') conda_exe = join(conda_prefix, 'Scripts', 'conda.exe')
else: else:
conda_exe = join(conda_prefix, 'bin', 'conda') conda_exe = join(conda_prefix, 'bin', 'conda')
conda_powershell_module = dals(""" conda_powershell_module = dals("""
#region conda initialize #region conda initialize
# !! Contents within this block are managed by 'conda init' !! # !! Contents within this block are managed by 'conda init' !!
(& {conda_exe} "shell.powershell" "hook") | Out-String | Invoke-Expression (& "{conda_exe}" "shell.powershell" "hook") | Out-String | Invoke-Expression
#endregion #endregion
""".format(conda_exe=conda_exe)) """.format(conda_exe=conda_exe))
return conda_powershell_module return conda_powershell_module
def init_powershell_user(target_path, conda_prefix): def init_powershell_user(target_path, conda_prefix):
# target_path: $PROFILE # target_path: $PROFILE
profile_path = target_path profile_path = target_path
# NB: the user may not have created a profile. We need to check # NB: the user may not have created a profile. We need to check
 End of changes. 5 change blocks. 
8 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)