Esempio n. 1
0
File: plan.py Progetto: jschaf/conda
def execute_plan(plan, index=None, verbose=False):
    if verbose:
        from conda.console import setup_verbose_handlers
        setup_verbose_handlers()

    # 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)
        elif cmd == SYMLINK_CONDA:
            install.symlink_conda(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)
Esempio n. 2
0
def execute_plan(plan, index=None, verbose=False):
    if verbose:
        from conda.console import setup_verbose_handlers
        setup_verbose_handlers()

    # 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, index=index)
        elif cmd == UNLINK:
            install.unlink(prefix, arg)
        elif cmd == SYMLINK_CONDA:
            install.symlink_conda(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)
Esempio n. 3
0
def UNLINK_CMD(state, arg):
    install.unlink(state['prefix'], arg)
Esempio n. 4
0
def UNLINK_CMD(state, arg):
    install.unlink(state["prefix"], arg)
Esempio n. 5
0
def UNLINK_CMD(state, arg):
    install.unlink(state['prefix'], arg)
Esempio n. 6
0
def UNLINK_CMD(state, dist):
    install.unlink(state['prefix'], dist)
Esempio n. 7
0
                              'It may be that the content is out of synch. '
                              'Have you run a build of this environment?\n'
                              "One of the designs of the conda-manager is "
                              'that a MANIFEST does not guarantee that all '
                              'of the distributions \nhave come from the existing '
                              "recipes (particularly if a recipe's version has "
                              "been decreased).".format(dist, dist_tar))
            src_pkgs = os.path.join(pkgs_dir, source_name)
            if not os.path.exists(src_pkgs):
                os.makedirs(src_pkgs)
            if not cinstall.is_extracted(src_pkgs, dist):
                placed_dist_file = os.path.join(src_pkgs, dist + '.tar.bz2')
                if not os.path.exists(placed_dist_file):
                    import shutil
                    shutil.copy(dist_tar, placed_dist_file)
                cinstall.extract(src_pkgs, dist)
                # Tidy up immediately by removing the distribution.
                os.remove(placed_dist_file)

    # Remove any packages which are no longer needed.
    for dist in ci.linked(prefix):
        if dist not in for_installation:
            cinstall.unlink(prefix, dist)

    # Install the packages.
    for source_name, packages in packages_by_source.items():
        src_distro_dir = conda_manifest.config.src_distributions_dir(source)
        for dist in packages:
            src_pkgs = os.path.join(pkgs_dir, source_name)
            cinstall.link(src_pkgs, prefix, dist)