From 0dbddc907b6e78ac0c571cd5369c9e91b01ac2df Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Thu, 3 Nov 2016 18:04:43 +0300 Subject: [PATCH] fix PY-17586 Conda: No repositories for installing packages PY-20477 Couldn't install and update packages using conda interpreter --- python/helpers/conda_packaging_tool.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/python/helpers/conda_packaging_tool.py b/python/helpers/conda_packaging_tool.py index b4680b915e97..051848d23fd5 100644 --- a/python/helpers/conda_packaging_tool.py +++ b/python/helpers/conda_packaging_tool.py @@ -10,8 +10,13 @@ def usage(): exit(ERROR_WRONG_USAGE) def do_list_available_packages(): - from conda.cli.main_search import common - index = common.get_index_trap() + try: + from conda.cli.main_search import common + index = common.get_index_trap() + except ImportError: + from conda.cli.main_search import get_index + index = get_index() + for pkg in index.values(): sys.stdout.write("\t".join([pkg["name"], pkg["version"], ":".join(pkg["depends"])])+chr(10)) sys.stdout.flush() @@ -19,9 +24,15 @@ def do_list_available_packages(): def do_list_channels(): import conda.config as config - for channel in config.get_channel_urls(): - sys.stdout.write(channel+chr(10)) - sys.stdout.flush() + if hasattr(config, "get_channel_urls"): + channels = config.get_channel_urls() + else: + channels = config.context.channels + for channel in channels: + if channel != 'defaults': + sys.stdout.write(channel+chr(10)) + sys.stdout.flush() + def main(): retcode = 0