def get_spec(spec=None, force=False):
    '\n    Check if spec.yaml exists on mirrors and return it if it does\n    '
    global _cached_specs
    urls = set()
    if (spec is None):
        return {}
    specfile_name = tarball_name(spec, '.spec.yaml')
    if (not spack.mirror.MirrorCollection()):
        tty.debug('No Spack mirrors are currently configured')
        return {}
    if (_cached_specs and (spec in _cached_specs)):
        return _cached_specs
    for mirror in spack.mirror.MirrorCollection().values():
        fetch_url_build_cache = url_util.join(mirror.fetch_url, _build_cache_relative_path)
        mirror_dir = url_util.local_file_path(fetch_url_build_cache)
        if mirror_dir:
            tty.msg(('Finding buildcaches in %s' % mirror_dir))
            link = url_util.join(fetch_url_build_cache, specfile_name)
            urls.add(link)
        else:
            tty.msg(('Finding buildcaches at %s' % url_util.format(fetch_url_build_cache)))
            link = url_util.join(fetch_url_build_cache, specfile_name)
            urls.add(link)
    return try_download_specs(urls=urls, force=force)
Check if spec.yaml exists on mirrors and return it if it does
def get_spec(spec=None, force=False):
    '\n    \n    '
    global _cached_specs
    urls = set()
    if (spec is None):
        return {}
    specfile_name = tarball_name(spec, '.spec.yaml')
    if (not spack.mirror.MirrorCollection()):
        tty.debug('No Spack mirrors are currently configured')
        return {}
    if (_cached_specs and (spec in _cached_specs)):
        return _cached_specs
    for mirror in spack.mirror.MirrorCollection().values():
        fetch_url_build_cache = url_util.join(mirror.fetch_url, _build_cache_relative_path)
        mirror_dir = url_util.local_file_path(fetch_url_build_cache)
        if mirror_dir:
            tty.msg(('Finding buildcaches in %s' % mirror_dir))
            link = url_util.join(fetch_url_build_cache, specfile_name)
            urls.add(link)
        else:
            tty.msg(('Finding buildcaches at %s' % url_util.format(fetch_url_build_cache)))
            link = url_util.join(fetch_url_build_cache, specfile_name)
            urls.add(link)
    return try_download_specs(urls=urls, force=force)