def fetch_tarballs(url, name, version): """Try to find versions of the supplied archive by scraping the web. Prompts the user to select how many to download if many are found. """ versions = spack.util.web.find_versions_of_archive(url) rkeys = sorted(versions.keys(), reverse=True) versions = OrderedDict(zip(rkeys, (versions[v] for v in rkeys))) archives_to_fetch = 1 if not versions: # If the fetch failed for some reason, revert to what the user provided versions = { version : url } elif len(versions) > 1: tty.msg("Found %s versions of %s:" % (len(versions), name), *spack.cmd.elide_list( ["%-10s%s" % (v,u) for v, u in versions.iteritems()])) print archives_to_fetch = tty.get_number( "Include how many checksums in the package file?", default=5, abort='q') if not archives_to_fetch: tty.die("Aborted.") sorted_versions = sorted(versions.keys(), reverse=True) sorted_urls = [versions[v] for v in sorted_versions] return sorted_versions[:archives_to_fetch], sorted_urls[:archives_to_fetch]
def fetch_tarballs(url, name, version): """Try to find versions of the supplied archive by scraping the web. Prompts the user to select how many to download if many are found.""" versions = spack.util.web.find_versions_of_archive(url) rkeys = sorted(versions.keys(), reverse=True) versions = OrderedDict(zip(rkeys, (versions[v] for v in rkeys))) archives_to_fetch = 1 if not versions: # If the fetch failed for some reason, revert to what the user provided versions = {version: url} elif len(versions) > 1: tty.msg("Found %s versions of %s:" % (len(versions), name), *spack.cmd.elide_list( ["%-10s%s" % (v, u) for v, u in versions.iteritems()])) print('') archives_to_fetch = tty.get_number( "Include how many checksums in the package file?", default=5, abort='q') if not archives_to_fetch: tty.die("Aborted.") sorted_versions = sorted(versions.keys(), reverse=True) sorted_urls = [versions[v] for v in sorted_versions] return sorted_versions[:archives_to_fetch], sorted_urls[:archives_to_fetch]
tty.msg("This looks like a URL for %s version %s." % (name, version)) tty.msg("Creating template for package %s" % name) versions = spack.util.web.find_versions_of_archive(url) rkeys = sorted(versions.keys(), reverse=True) versions = OrderedDict(zip(rkeys, (versions[v] for v in rkeys))) archives_to_fetch = 1 if not versions: # If the fetch failed for some reason, revert to what the user provided versions = { version : url } elif len(versions) > 1: tty.msg("Found %s versions of %s:" % (len(versions), name), *spack.cmd.elide_list( ["%-10s%s" % (v,u) for v, u in versions.iteritems()])) print archives_to_fetch = tty.get_number( "Include how many checksums in the package file?", default=5, abort='q') if not archives_to_fetch: tty.msg("Aborted.") return guesser = ConfigureGuesser() ver_hash_tuples = spack.cmd.checksum.get_checksums( versions.keys()[:archives_to_fetch], [versions[v] for v in versions.keys()[:archives_to_fetch]], first_stage_function=guesser, keep_stage=args.keep_stage)