Ejemplo n.º 1
0
def main(info, verbose=True):
    if 'channels' in info:
        global index
        index = fetch_index(
            tuple('%s/%s/' % (url.rstrip('/'), platform)
                  for url in info['channels']
                  for platform in (info['_platform'], 'noarch')))

    if 'specs' in info:
        resolve(info, verbose)
    exclude_packages(info)
    if 'packages' in info:
        handle_packages(info)

    if not info.get('install_in_dependency_order'):
        dists.sort()
    move_python_first()

    all_names = set(name_dist(fn) for fn in dists)
    for name in info.get('menu_packages', []):
        if name not in all_names:
            sys.exit("Error: no such package (in menu_packages): %s" % name)

    if verbose:
        show(info)
    check_dists()
    fetch(info)

    info['_dists'] = list(dists)
Ejemplo n.º 2
0
def main(info, verbose=True):
    if 'channels' in info:
        global index
        index = fetch_index(
                  tuple('%s/%s/' % (url.rstrip('/'), platform)
                        for url in info['channels']
                        for platform in (info['_platform'], 'noarch')))

    if 'specs' in info:
        resolve(info, verbose)
    exclude_packages(info)
    if 'packages' in info:
        handle_packages(info)

    if not info.get('install_in_dependency_order'):
        dists.sort()
    move_python_first()

    all_names = set(name_dist(fn) for fn in dists)
    for name in info.get('menu_packages', []):
        if name not in all_names:
            sys.exit("Error: no such package (in menu_packages): %s" % name)

    if verbose:
        show(info)
    check_dists()
    fetch(info)

    info['_dists'] = list(dists)
Ejemplo n.º 3
0
def fetch(info):
    download_dir = info['_download_dir']
    if not isdir(download_dir):
        os.makedirs(download_dir)

    info['_urls'] = []
    for fn in dists:
        path = join(download_dir, fn)
        url = urls.get(fn)
        md5 = md5s.get(fn)
        if url:
            url_index = fetch_index((url, ))
            try:
                pkginfo = url_index[fn]
            except KeyError:
                sys.exit("Error: no package '%s' in %s" % (fn, url))
        else:
            pkginfo = index[fn]

        assert pkginfo['channel'].endswith('/')
        info['_urls'].append((pkginfo['channel'] + fn, pkginfo['md5']))

        if md5 and md5 != pkginfo['md5']:
            sys.exit("Error: MD5 sum for '%s' does not match in remote "
                     "repodata %s" % (fn, url))

        if isfile(path) and md5_file(path) == pkginfo['md5']:
            continue
        print('fetching: %s' % fn)
        fetch_pkg(pkginfo, download_dir)
Ejemplo n.º 4
0
def fetch(info):
    download_dir = info['_download_dir']
    if not isdir(download_dir):
        os.makedirs(download_dir)

    info['_urls'] = []
    for fn in dists:
        path = join(download_dir, fn)
        url = urls.get(fn)
        md5 = md5s.get(fn)
        if url:
            url_index = fetch_index((url,))
            try:
                pkginfo = url_index[fn]
            except KeyError:
                sys.exit("Error: no package '%s' in %s" % (fn, url))
        else:
            pkginfo = index[fn]

        assert pkginfo['channel'].endswith('/')
        info['_urls'].append((pkginfo['channel'] + fn, pkginfo['md5']))

        if md5 and md5 != pkginfo['md5']:
            sys.exit("Error: MD5 sum for '%s' does not match in remote "
                     "repodata %s" % (fn, url))

        if isfile(path) and md5_file(path) == pkginfo['md5']:
            continue
        print('fetching: %s' % fn)
        fetch_pkg(pkginfo, download_dir)
Ejemplo n.º 5
0
def main(info, verbose=True, dry_run=False, use_conda=False):
    if 'channels' in info:
        global index
        if use_conda:
            from conda.models.channel import prioritize_channels
            from conda.exports import fetch_index
            channels = tuple('%s/%s/' % (url.rstrip('/'), platform)
                             for url in info['channels']
                             for platform in (info['_platform'], 'noarch'))
            index = fetch_index(prioritize_channels(channels))
        else:
            from libconda.fetch import fetch_index
            index = fetch_index(
                tuple('%s/%s/' % (url.rstrip('/'), platform)
                      for url in info['channels']
                      for platform in (info['_platform'], 'noarch')))

    if 'specs' in info:
        resolve(info, verbose, use_conda)
    exclude_packages(info)
    if 'packages' in info:
        handle_packages(info)

    if not info.get('install_in_dependency_order'):
        dists.sort()
    move_python_first()

    all_names = set(name_dist(fn) for fn in dists)
    for name in info.get('menu_packages', []):
        if name not in all_names:
            print("WARNING: no such package (in menu_packages): %s" % name)

    if verbose:
        show(info)
    check_dists()
    if dry_run:
        return
    fetch(info, use_conda)

    info['_dists'] = list(dists)
Ejemplo n.º 6
0
def fetch(info, use_conda):
    # always use the libconda fetch_index function here since no
    # channel priority is needed
    from libconda.fetch import fetch_index
    download_dir = info['_download_dir']
    if not isdir(download_dir):
        os.makedirs(download_dir)

    info['_urls'] = []
    for dist in dists:
        fn = filename_dist(dist)
        path = join(download_dir, fn)
        url = urls.get(dist)
        md5 = md5s.get(dist)
        if url:
            url_index = fetch_index((url, ))
            try:
                pkginfo = url_index[dist]
            except KeyError:
                sys.exit("Error: no package '%s' in %s" % (dist, url))
        else:
            pkginfo = index[dist]

        if not pkginfo['channel'].endswith('/'):
            pkginfo['channel'] += '/'
        assert pkginfo['channel'].endswith('/')
        info['_urls'].append((pkginfo['channel'] + fn, pkginfo['md5']))

        if md5 and md5 != pkginfo['md5']:
            sys.exit("Error: MD5 sum for '%s' does not match in remote "
                     "repodata %s" % (fn, url))

        if isfile(path) and md5_file(path) == pkginfo['md5']:
            continue
        print('fetching: %s' % fn)
        if use_conda:
            from conda.exports import download as fetch_pkg
            pkg_url = pkginfo['channel'] + fn
            fetch_pkg(pkg_url, path)
        else:
            from libconda.fetch import fetch_pkg
            fetch_pkg(pkginfo, download_dir)
Ejemplo n.º 7
0
def main(info, verbose=True):
    if 'channels' in info:
        global index
        index = fetch_index(
                  tuple('%s/%s/' % (url.rstrip('/'), info['_platform'])
                        for url in info['channels']))

    if 'specs' in info:
        resolve(info, verbose)
    exclude_packages(info)
    if 'packages' in info:
        handle_packages(info)

    if not info.get('install_in_dependency_order'):
        dists.sort()
    move_python_first()

    if verbose:
        show(info)
    check_dists()
    fetch(info)

    info['_dists'] = list(dists)
Ejemplo n.º 8
0
def main(info, verbose=True):
    if 'channels' in info:
        global index
        index = fetch_index(
                  tuple('%s/%s/' % (url.rstrip('/'), platform)
                        for url in info['channels']
                            for platform in (info['_platform'], 'noarch')))

    if 'specs' in info:
        resolve(info, verbose)
    exclude_packages(info)
    if 'packages' in info:
        handle_packages(info)

    if not info.get('install_in_dependency_order'):
        dists.sort()
    move_python_first()

    if verbose:
        show(info)
    check_dists()
    fetch(info)

    info['_dists'] = list(dists)