Ejemplo n.º 1
0
 def __enter__(self):
     if isfile(self.url):
         # if we provide the file itself, no tmp dir is created
         self.tmp_dir = None
         return self.url
     else:
         if self.verbose:
             from conda.console import setup_handlers
             setup_handlers()
         self.tmp_dir = tempfile.mkdtemp()
         dst = join(self.tmp_dir, basename(self.url))
         download(self.url, dst)
         return dst
Ejemplo n.º 2
0
 def __enter__(self):
     if isfile(self.url):
         # if we provide the file itself, no tmp dir is created
         self.tmp_dir = None
         return self.url
     else:
         if self.verbose:
             from conda.console import setup_handlers
             setup_handlers()
         self.tmp_dir = tempfile.mkdtemp()
         dst = join(self.tmp_dir, basename(self.url))
         download(self.url, dst)
         return dst
Ejemplo n.º 3
0
def execute_plan(plan, index=None, verbose=False):
    if verbose:
        from conda.console import setup_handlers

        setup_handlers()

    progress_cmds = set([EXTRACT, RM_EXTRACTED, LINK, UNLINK])
    # set default prefix
    prefix = config.root_dir
    i = None
    cmds = cmds_from_plan(plan)

    for cmd, arg in cmds:
        if i is not None and cmd in progress_cmds:
            i += 1
            getLogger("progress.update").info((name_dist(arg), i))

        if cmd == PREFIX:
            prefix = arg
        elif cmd == PRINT:
            getLogger("print").info(arg)
        elif cmd == FETCH:
            fetch(index, arg)
        elif cmd == PROGRESS:
            i = 0
            maxval = int(arg)
            getLogger("progress.start").info(maxval)
        elif cmd == EXTRACT:
            install.extract(config.pkgs_dir, arg)
        elif cmd == RM_EXTRACTED:
            install.rm_extracted(config.pkgs_dir, arg)
        elif cmd == RM_FETCHED:
            install.rm_fetched(config.pkgs_dir, arg)
        elif cmd == LINK:
            link(prefix, arg)
        elif cmd == UNLINK:
            install.unlink(prefix, arg)
        else:
            raise Exception("Did not expect command: %r" % cmd)

        if i is not None and cmd in progress_cmds and maxval == i:
            i = None
            getLogger("progress.stop").info(None)

    install.messages(prefix)
Ejemplo n.º 4
0
def execute_plan(plan, index=None, verbose=False):
    if verbose:
        from conda.console import setup_handlers
        setup_handlers()

    progress_cmds = set([EXTRACT, RM_EXTRACTED, LINK, UNLINK])
    # set default prefix
    prefix = config.root_dir
    i = None
    cmds = cmds_from_plan(plan)

    for cmd, arg in cmds:
        if i is not None and cmd in progress_cmds:
            i += 1
            getLogger('progress.update').info((install.name_dist(arg), i))

        if cmd == PREFIX:
            prefix = arg
        elif cmd == PRINT:
            getLogger('print').info(arg)
        elif cmd == FETCH:
            fetch(index, arg)
        elif cmd == PROGRESS:
            i = 0
            maxval = int(arg)
            getLogger('progress.start').info(maxval)
        elif cmd == EXTRACT:
            install.extract(config.pkgs_dirs[0], arg)
        elif cmd == RM_EXTRACTED:
            install.rm_extracted(config.pkgs_dirs[0], arg)
        elif cmd == RM_FETCHED:
            install.rm_fetched(config.pkgs_dirs[0], arg)
        elif cmd == LINK:
            link(prefix, arg)
        elif cmd == UNLINK:
            install.unlink(prefix, arg)
        else:
            raise Exception("Did not expect command: %r" % cmd)

        if i is not None and cmd in progress_cmds and maxval == i:
            i = None
            getLogger('progress.stop').info(None)

    install.messages(prefix)
Ejemplo n.º 5
0
from functools import partial

from conda import verlib
from conda.utils import memoize
from conda.compat import itervalues, iteritems
from conda.logic import (false, true, sat, min_sat, generate_constraints,
    bisect_constraints, evaluate_eq, minimal_unsatisfiable_subset, MaximumIterationsError)
from conda.console import setup_handlers
from conda import config
from conda.toposort import toposort

log = logging.getLogger(__name__)
dotlog = logging.getLogger('dotupdate')
stdoutlog = logging.getLogger('stdoutlog')
stderrlog = logging.getLogger('stderrlog')
setup_handlers()


def normalized_version(version):
    version = version.replace('rc', '.dev99999')
    try:
        return verlib.NormalizedVersion(version)
    except verlib.IrrationalVersionError:
        suggested_version = verlib.suggest_normalized_version(version)
        if suggested_version:
            return verlib.NormalizedVersion(suggested_version)
        return version


class NoPackagesFound(RuntimeError):
    def __init__(self, msg, pkgs):
Ejemplo n.º 6
0
from collections import defaultdict
from functools import partial

from conda import verlib
from conda.utils import memoize
from conda.compat import itervalues, iteritems
from conda.logic import (false, true, sat, min_sat, generate_constraints,
                         bisect_constraints, evaluate_eq)
from conda.console import setup_handlers
from conda import config

log = logging.getLogger(__name__)
dotlog = logging.getLogger('dotupdate')
stdoutlog = logging.getLogger('stdoutlog')
stderrlog = logging.getLogger('stderrlog')
setup_handlers()


def normalized_version(version):
    version = version.replace('rc', '.dev99999')
    try:
        return verlib.NormalizedVersion(version)
    except verlib.IrrationalVersionError:
        suggested_version = verlib.suggest_normalized_version(version)
        if suggested_version:
            return verlib.NormalizedVersion(suggested_version)
        return version


class NoPackagesFound(RuntimeError):
    def __init__(self, msg, pkgs):