Skip to content

Commit

Permalink
Deprecate conda private environment (conda#12101)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard authored Nov 15, 2022
1 parent 6ab3954 commit 1967fab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
18 changes: 8 additions & 10 deletions conda/base/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from logging import getLogger
from typing import Optional
import os
from os.path import abspath, basename, expanduser, isdir, isfile, join, split as path_split
from os.path import abspath, expanduser, isdir, isfile, join, split as path_split
import platform
import sys
import struct
Expand Down Expand Up @@ -475,7 +475,13 @@ def arch_name(self):

@property
def conda_private(self):
return conda_in_private_env()
warnings.warn(
"`conda.base.context.context.conda_private` is pending deprecation and will be "
"removed in a future release. It's meaningless and any special meaning it may have "
"held is now void.",
PendingDeprecationWarning,
)
return False

@property
def platform(self):
Expand Down Expand Up @@ -629,8 +635,6 @@ def target_prefix(self):
def root_prefix(self):
if self._root_prefix:
return abspath(expanduser(self._root_prefix))
elif conda_in_private_env():
return abspath(join(self.conda_prefix, '..', '..'))
else:
return self.conda_prefix

Expand Down Expand Up @@ -1612,12 +1616,6 @@ def description_map(self):
)


def conda_in_private_env():
# conda is located in its own private environment named '_conda_'
envs_dir, env_name = path_split(sys.prefix)
return env_name == '_conda_' and basename(envs_dir) == 'envs'


def reset_context(search_path=SEARCH_PATH, argparse_args=None):
global context
context.__init__(search_path, argparse_args)
Expand Down
3 changes: 1 addition & 2 deletions conda/cli/main_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .common import print_envs_list, stdout_json
from .. import CONDA_PACKAGE_ROOT, __version__ as conda_version
from ..base.context import conda_in_private_env, context, env_name, sys_rc_path, user_rc_path
from ..base.context import context, env_name, sys_rc_path, user_rc_path
from ..common.compat import on_win
from ..common.url import mask_anaconda_token
from ..core.index import _supplement_index_with_system
Expand Down Expand Up @@ -155,7 +155,6 @@ def get_info_dict(system=False):
conda_build_version=conda_build_version,
root_prefix=context.root_prefix,
conda_prefix=context.conda_prefix,
conda_private=conda_in_private_env(),
av_data_dir=context.av_data_dir,
av_metadata_url_base=context.signing_metadata_url_base,
root_writable=context.root_writable,
Expand Down
1 change: 0 additions & 1 deletion conda/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
root_dir = conda.base.context.context.root_prefix
root_writable = conda.base.context.context.root_writable
subdir = conda.base.context.context.subdir
conda_private = conda.base.context.context.conda_private
conda_build = conda.base.context.context.conda_build

from .models.channel import get_conda_build_local_url # NOQA
Expand Down

0 comments on commit 1967fab

Please sign in to comment.