def __init__(self):
"""Constructor."""
# Extend sys.path so that conda.cli module can be imported, then import
# conda's CLI modules.
self.conda_sp_dpath = self._get_conda_sp_dpath()
self.prefix_dpath = os.path.join(
os.path.split(os.path.split(os.path.split(
self.conda_sp_dpath
)[0])[0])[0],
'envs',
)
(self._base_mod,
self._main_mod,
self._main_install_mod,
self._main_create_mod) = self._import_conda_modules()
self._create_parser, self._install_parser = None, None
parser, sub_parsers = self._main_mod.generate_parser()
self._main_install_mod.configure_parser(sub_parsers)
self._main_create_mod.configure_parser(sub_parsers)
subparsers_action = None
for action in parser._subparsers._actions:
if isinstance(action, argparse._SubParsersAction):
subparsers_action = action
break
action_parser_map = subparsers_action._name_parser_map
if 'install' in action_parser_map:
self._install_parser = action_parser_map['install']
# These arguments are somehow dropped from the Namespace
self._install_parser.add_argument('--no-default-packages',
default=False)
self._install_parser.add_argument('--clone', default=False)
if 'create' in action_parser_map:
self._create_parser = action_parser_map['create']
# Additional branches may be added here to support more of conda's
# subparsers
评论列表
文章目录