Only use list if list_url set

This commit will make urls from list_url only checked if `list_url` is
set in the package file. This makes more sense as there is no need to
check for those if the attribute is not present. If `url` is present and
`list_url` is not then it would result in the same url. If
`url_for_version` is used then that will not work anyway.
This commit is contained in:
Glenn Johnson 2016-07-23 22:56:08 -05:00
parent 4181fd79cd
commit 4f09e8c975

View File

@ -37,7 +37,7 @@
import spack.config import spack.config
import spack.fetch_strategy as fs import spack.fetch_strategy as fs
import spack.error import spack.error
from spack.version import Version from spack.version import *
STAGE_PREFIX = 'spack-stage-' STAGE_PREFIX = 'spack-stage-'
@ -308,13 +308,14 @@ def fetch(self, mirror_only=False):
archive_version = spack.url.parse_version(self.default_fetcher.url) archive_version = spack.url.parse_version(self.default_fetcher.url)
package_name = os.path.dirname(self.mirror_path) package_name = os.path.dirname(self.mirror_path)
pkg = spack.repo.get(package_name) pkg = spack.repo.get(package_name)
versions = pkg.fetch_remote_versions() if pkg.list_url is not None:
try: versions = pkg.fetch_remote_versions()
url_from_list = versions[Version(archive_version)] try:
fetchers.append(fs.URLFetchStrategy(url_from_list, digest)) url_from_list = versions[Version(archive_version)]
except KeyError: fetchers.append(fs.URLFetchStrategy(url_from_list, digest))
tty.msg("Can not find version %s in url_list" % except KeyError:
archive_version) tty.msg("Can not find version %s in url_list" %
archive_version)
for fetcher in fetchers: for fetcher in fetchers:
try: try: