Example #1
0
File: main.py Project: zapnat/conda
def main():
    initialize_logging()
    parser = create_parser()
    args = parser.parse_args()
    context.__init__(argparse_args=args)
    init_loggers(context)
    return conda_exception_handler(do_call, args, parser)
Example #2
0
def main():
    initialize_logging()
    parser = create_parser()
    args = parser.parse_args()
    context.__init__(SEARCH_PATH, 'conda', args)
    init_loggers(context)
    return conda_exception_handler(args.func, args, parser)
Example #3
0
def main():
    initialize_logging()
    parser = create_parser()
    args = parser.parse_args()
    os.environ["CONDA_AUTO_UPDATE_CONDA"] = "false"
    context.__init__(argparse_args=args)
    init_loggers(context)
    return conda_exception_handler(do_call, args, parser)
Example #4
0
def run_inprocess_conda_command(command):
    reset_context(())
    with argv(split(command)), captured() as c, replace_log_streams():
        initialize_logging()
        try:
            exit_code = cli.main()
        except SystemExit:
            pass
    print(c.stderr, file=sys.stderr)
    print(c.stdout)
    return c.stdout, c.stderr, exit_code
Example #5
0
def run_inprocess_conda_command(command):
    reset_context(())
    with argv(split(command)), captured() as c, replace_log_streams():
        initialize_logging()
        try:
            exit_code = cli.main()
        except SystemExit:
            pass
    print(c.stderr, file=sys.stderr)
    print(c.stdout)
    return c.stdout, c.stderr, exit_code
Example #6
0
def run_inprocess_conda_command(command, disallow_stderr=True):
    # anything that uses this function is an integration test
    reset_context(())
    with argv(split(command)), captured(disallow_stderr) as c:
        initialize_logging()
        try:
            exit_code = cli.main()
        except SystemExit:
            pass
    print(c.stderr, file=sys.stderr)
    print(c.stdout)
    return c.stdout, c.stderr, exit_code
Example #7
0
def run_inprocess_conda_command(command, disallow_stderr=True):
    # anything that uses this function is an integration test
    reset_context(())
    # May want to do this to command:
    with argv(encode_arguments(shlex_split_unicode(command))), captured(disallow_stderr) as c:
        initialize_logging()
        try:
            exit_code = cli.main(*sys.argv)
        except SystemExit:
            pass
    print(c.stderr, file=sys.stderr)
    print(c.stdout)
    return c.stdout, c.stderr, exit_code
Example #8
0
def run_inprocess_conda_command(command, disallow_stderr=True):
    # anything that uses this function is an integration test
    reset_context(())
    # May want to do this to command:
    with argv(encode_arguments(shlex_split_unicode(command))), captured(disallow_stderr) as c:
        initialize_logging()
        try:
            exit_code = cli.main(*sys.argv)
        except SystemExit:
            pass
    print(c.stderr, file=sys.stderr)
    print(c.stdout)
    return c.stdout, c.stderr, exit_code
Example #9
0
# This is just here so that tests is a package, so that dotted relative
# imports work.
from __future__ import print_function
from conda.gateways.logging import initialize_logging
import pytest
import sys
initialize_logging()

# Attempt to move any conda entries in PATH to the front of it.
# IDEs have their own ideas about how PATH should be managed and
# they do dumb stuff like add /usr/bin to the front of it
# meaning conda takes a submissve role and the wrong stuff
# runs (when other conda prefixes get activated they replace
# the wrongly placed entries with newer wrongly placed entries).
#
# Note, there's still condabin to worry about here, and also should
# we not remove all traces of conda instead of just this fixup?
# Ideally we'd have two modes, 'removed' and 'fixed'. I have seen
# condabin come from an entirely different installation than
# CONDA_PREFIX too in some instances and that really needs fixing.

import os
from os.path import dirname, normpath, join, isfile
from subprocess import check_output


def encode_for_env_var(value):
    if isinstance(value, str):
        return value
    if sys.version_info[0] == 2:
        _unicode = unicode
Example #10
0
from conda.common.configuration import YamlRawParameter
from conda.common.io import env_unmodified, env_var, env_vars
from conda.common.serialize import yaml_load
from conda.common.url import join, join_url
from conda.gateways.disk.create import mkdir_p
from conda.gateways.disk.delete import rm_rf
from conda.gateways.logging import initialize_logging
from conda.models.channel import Channel, prioritize_channels
from conda.utils import on_win

try:
    from unittest.mock import patch
except ImportError:
    from mock import patch

initialize_logging()
log = getLogger(__name__)


class DefaultConfigChannelTests(TestCase):

    @classmethod
    def setUpClass(cls):
        reset_context(())
        cls.platform = context.subdir
        cls.DEFAULT_URLS = ['https://repo.anaconda.com/pkgs/main/%s' % cls.platform,
                            'https://repo.anaconda.com/pkgs/main/noarch',
                            'https://repo.anaconda.com/pkgs/r/%s' % cls.platform,
                            'https://repo.anaconda.com/pkgs/r/noarch',
                            ]
        if on_win: