示例#1
0
def rm_pkgs_cache(dist):
    '''
    Removes dist from the package cache.
    '''
    cc.pkgs_dirs = cc.pkgs_dirs[:1]
    rmplan = ['RM_FETCHED %s' % dist, 'RM_EXTRACTED %s' % dist]
    plan.execute_plan(rmplan)
示例#2
0
文件: share.py 项目: rhs2132/conda
def clone_bundle(path, prefix):
    """
    Clone the bundle (located at `path`) by creating a new environment at
    `prefix`.
    The directory `path` is located in should be some temp directory or
    some other directory OUTSITE /opt/anaconda (this function handles
    copying the of the file if necessary for you).  After calling this
    funtion, the original file (at `path`) may be removed.
    """
    assert not abspath(path).startswith(abspath(config.root_dir))
    assert not isdir(prefix)
    fn = basename(path)
    assert re.match(r'share-[0-9a-f]{40}-\d+\.tar\.bz2$', fn), fn
    dist = fn[:-8]

    if not install.is_extracted(config.pkgs_dir, dist):
        shutil.copyfile(path, join(config.pkgs_dir, dist + '.tar.bz2'))
        plan.execute_plan(['%s %s' % (plan.EXTRACT, dist)])
    assert install.is_extracted(config.pkgs_dir, dist)

    with open(join(config.pkgs_dir, dist, 'info', 'index.json')) as fi:
        meta = json.load(fi)

    # for backwards compatibility, use "requires" when "depends" is not there
    dists = ['-'.join(r.split())
             for r in meta.get('depends', meta.get('requires'))
             if not r.startswith('conda ')]
    dists.append(dist)

    actions = plan.ensure_linked_actions(dists, prefix)
    index = get_index()
    plan.display_actions(actions, index)
    plan.execute_actions(actions, index, verbose=True)

    os.unlink(join(prefix, 'conda-meta', dist + '.json'))
示例#3
0
def rm_pkgs_cache(dist):
    """
    Removes dist from the package cache.
    """
    cc.pkgs_dirs = cc.pkgs_dirs[:1]
    rmplan = ["RM_FETCHED %s" % dist, "RM_EXTRACTED %s" % dist]
    plan.execute_plan(rmplan)
示例#4
0
def rm_pkgs_cache(dist):
    '''
    Removes dist from the package cache.
    '''
    cc.pkgs_dirs = cc.pkgs_dirs[:1]
    rmplan = ['RM_FETCHED %s' % dist,
              'RM_EXTRACTED %s' % dist]
    plan.execute_plan(rmplan)
示例#5
0
文件: execute.py 项目: zonca/conda
def main():
    p = OptionParser(usage="usage: %prog [options] FILENAME",
                     description="execute an conda plan")

    p.add_option('-q', '--quiet', action="store_true")

    opts, args = p.parse_args()

    logging.basicConfig()

    if len(args) != 1:
        p.error('exactly one argument required')

    execute_plan(open(args[0]), get_index(), not opts.quiet)
示例#6
0
文件: execute.py 项目: 3kwa/conda
def main():
    p = OptionParser(
        usage="usage: %prog [options] FILENAME",
        description="execute an conda plan")

    p.add_option('-q', '--quiet',
                 action="store_true")

    opts, args = p.parse_args()

    logging.basicConfig()

    if len(args) != 1:
        p.error('exactly one argument required')

    execute_plan(open(args[0]), get_index(), not opts.quiet)
示例#7
0
    def test_execute_plan(self):
        initial_commands = inst.commands

        def set_commands(cmds):
            inst.commands = cmds
        self.addCleanup(lambda : set_commands(initial_commands))

        def INSTRUCTION_CMD(state, arg):
            INSTRUCTION_CMD.called = True
            INSTRUCTION_CMD.arg = arg

        set_commands({'INSTRUCTION': INSTRUCTION_CMD})

        old_plan = ['# plan', 'INSTRUCTION arg']

        plan.execute_plan(old_plan)

        self.assertTrue(INSTRUCTION_CMD.called)
        self.assertEqual(INSTRUCTION_CMD.arg, 'arg')
示例#8
0
    def test_execute_plan(self):
        initial_commands = inst.commands

        def set_commands(cmds):
            inst.commands = cmds
        self.addCleanup(lambda : set_commands(initial_commands))

        def INSTRUCTION_CMD(state, arg):
            INSTRUCTION_CMD.called = True
            INSTRUCTION_CMD.arg = arg

        set_commands({'INSTRUCTION': INSTRUCTION_CMD})

        old_plan = ['# plan', 'INSTRUCTION arg']

        plan.execute_plan(old_plan)

        self.assertTrue(INSTRUCTION_CMD.called)
        self.assertEqual(INSTRUCTION_CMD.arg, 'arg')
示例#9
0
文件: share.py 项目: tacaswell/conda
def old_clone_bundle(path, prefix):
    """
    Clone the bundle (located at `path`) by creating a new environment at
    `prefix`.
    The directory `path` is located in should be some temp directory or
    some other directory OUTSITE /opt/anaconda (this function handles
    copying the of the file if necessary for you).  After calling this
    funtion, the original file (at `path`) may be removed.
    """
    assert not abspath(path).startswith(abspath(config.root_dir))
    assert not isdir(prefix)
    fn = basename(path)
    assert re.match(r'share-[0-9a-f]{40}-\d+\.tar\.bz2$', fn), fn
    dist = fn[:-8]

    pkgs_dir = config.pkgs_dirs[0]
    if not install.is_extracted(pkgs_dir, dist):
        shutil.copyfile(path, join(pkgs_dir, dist + '.tar.bz2'))
        plan.execute_plan(['%s %s' % (plan.EXTRACT, dist)])
    assert install.is_extracted(pkgs_dir, dist)

    with open(join(pkgs_dir, dist, 'info', 'index.json')) as fi:
        meta = json.load(fi)

    # for backwards compatibility, use "requires" when "depends" is not there
    dists = [
        '-'.join(r.split())
        for r in meta.get('depends', meta.get('requires', []))
        if not r.startswith('conda ')
    ]
    dists.append(dist)

    actions = plan.ensure_linked_actions(dists, prefix)
    index = get_index()
    plan.execute_actions(actions, index, verbose=False)

    os.unlink(join(prefix, 'conda-meta', dist + '.json'))
示例#10
0
文件: build.py 项目: delicb/conda
def rm_pkgs_cache(dist):
    cc.pkgs_dirs = cc.pkgs_dirs[:1]
    rmplan = ['RM_FETCHED %s' % dist,
              'RM_EXTRACTED %s' % dist]
    plan.execute_plan(rmplan)
示例#11
0
文件: build.py 项目: dmj111/conda
def rm_pkgs_cache(dist):
    rmplan = ['RM_FETCHED %s' % dist,
              'RM_EXTRACTED %s' % dist]
    plan.execute_plan(rmplan)
示例#12
0
文件: build.py 项目: Studiogit/conda
def rm_pkgs_cache(dist):
    cc.pkgs_dirs = cc.pkgs_dirs[:1]
    rmplan = ['RM_FETCHED %s' % dist, 'RM_EXTRACTED %s' % dist]
    plan.execute_plan(rmplan)