Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] towards #6610 sudo workflow resolution #7181

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 14 additions & 4 deletions conda/base/context.py
Expand Up @@ -14,7 +14,6 @@
PLATFORM_DIRECTORIES, PREFIX_MAGIC_FILE, PathConflict, ROOT_ENV_NAME,
SEARCH_PATH, SafetyChecks)
from .. import __version__ as CONDA_VERSION
from .._vendor.appdirs import user_data_dir
from .._vendor.auxlib.collection import frozendict
from .._vendor.auxlib.decorators import memoize, memoizedproperty
from .._vendor.auxlib.ish import dals
Expand Down Expand Up @@ -419,12 +418,23 @@ def trash_dir(self):
mkdir_p(trash_dir)
return trash_dir

@property
@memoizedproperty
def _user_data_dir(self):
if on_win:
return user_data_dir(APP_NAME, APP_NAME)
from ..common.platform import is_admin_on_windows
if is_admin_on_windows():
from .._vendor.appdirs import site_data_dir
return site_data_dir(APP_NAME, APP_NAME)
else:
from .._vendor.appdirs import user_data_dir
return user_data_dir(APP_NAME, APP_NAME)
else:
return expand(join('~', '.conda'))
if 'SUDO_UID' in os.environ:
from pwd import getpwuid
pwentry = getpwuid(os.getuid())
return expand(join(pwentry.pw_dir, '.conda'))
else:
return expand(join('~', '.conda'))

@property
def default_prefix(self):
Expand Down