From 4f09e8c9759473257ca8857bfa09eeeeca08cafd Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Sat, 23 Jul 2016 22:56:08 -0500 Subject: 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. --- lib/spack/spack/stage.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index cf1c9d7b50..6cf736b3f0 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -37,7 +37,7 @@ import spack import spack.config import spack.fetch_strategy as fs import spack.error -from spack.version import Version +from spack.version import * STAGE_PREFIX = 'spack-stage-' @@ -308,13 +308,14 @@ class Stage(object): archive_version = spack.url.parse_version(self.default_fetcher.url) package_name = os.path.dirname(self.mirror_path) pkg = spack.repo.get(package_name) - versions = pkg.fetch_remote_versions() - try: - url_from_list = versions[Version(archive_version)] - fetchers.append(fs.URLFetchStrategy(url_from_list, digest)) - except KeyError: - tty.msg("Can not find version %s in url_list" % - archive_version) + if pkg.list_url is not None: + versions = pkg.fetch_remote_versions() + try: + url_from_list = versions[Version(archive_version)] + fetchers.append(fs.URLFetchStrategy(url_from_list, digest)) + except KeyError: + tty.msg("Can not find version %s in url_list" % + archive_version) for fetcher in fetchers: try: -- cgit v1.2.3-70-g09d2