def mirror_archive_filename(spec): """Get the name of the spec's archive in the mirror.""" if not spec.version.concrete: raise ValueError("mirror.path requires spec with concrete version.") fetcher = spec.package.fetcher if isinstance(fetcher, fs.URLFetchStrategy): # If we fetch this version with a URLFetchStrategy, use URL's archive type ext = url.downloaded_file_extension(fetcher.url) else: # Otherwise we'll make a .tar.gz ourselves ext = 'tar.gz' return "%s-%s.%s" % (spec.package.name, spec.version, ext)
def mirror_archive_filename(spec, fetcher): """Get the name of the spec's archive in the mirror.""" if not spec.version.concrete: raise ValueError("mirror.path requires spec with concrete version.") if isinstance(fetcher, fs.URLFetchStrategy): if fetcher.expand_archive: # If we fetch this version with a URLFetchStrategy, use URL's archive type ext = url.downloaded_file_extension(fetcher.url) else: # If the archive shouldn't be expanded, don't check for its extension. ext = None else: # Otherwise we'll make a .tar.gz ourselves ext = 'tar.gz' filename = "%s-%s" % (spec.package.name, spec.version) if ext: filename += ".%s" % ext return filename