diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2020-03-12 09:21:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-12 09:21:19 +0100 |
commit | 59b6822a4749af28417541981f160d4a1766bd46 (patch) | |
tree | 9ef4b512fdd6773b9baf96f70d5ccab51ab49784 /lib | |
parent | a22d52a67dffa8dbf1632ce17129de32ca39c591 (diff) | |
download | spack-59b6822a4749af28417541981f160d4a1766bd46.tar.gz spack-59b6822a4749af28417541981f160d4a1766bd46.tar.bz2 spack-59b6822a4749af28417541981f160d4a1766bd46.tar.xz spack-59b6822a4749af28417541981f160d4a1766bd46.zip |
Creating versions from urls doesn't modify class attributes (#15452)
fixes #15449
Before this PR a call to pkg.url_for_version was modifying
class attributes determining different results for subsequents
calls and an error when the urls was empty.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/fetch_strategy.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/test/url_fetch.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index f4d46b5f8c..85e93164a8 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -1261,7 +1261,7 @@ def _from_merged_attrs(fetcher, pkg, version): # TODO: refactor this logic into its own method or function # TODO: to avoid duplication mirrors = [spack.url.substitute_version(u, version) - for u in getattr(pkg, 'urls', [])] + for u in getattr(pkg, 'urls', [])[1:]] attrs = {fetcher.url_attr: url, 'mirrors': mirrors} else: url = getattr(pkg, fetcher.url_attr) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 56bdab22c1..ff45355055 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -763,7 +763,7 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)): # If no specific URL, use the default, class-level URL url = getattr(self, 'url', None) urls = getattr(self, 'urls', [None]) - default_url = url or urls.pop(0) + default_url = url or urls[0] # if no exact match AND no class-level default, use the nearest URL if not default_url: diff --git a/lib/spack/spack/test/url_fetch.py b/lib/spack/spack/test/url_fetch.py index 71a122455f..679240049d 100644 --- a/lib/spack/spack/test/url_fetch.py +++ b/lib/spack/spack/test/url_fetch.py @@ -32,7 +32,7 @@ def pkg_factory(): def factory(url, urls): def fn(v): - main_url = url or urls.pop(0) + main_url = url or urls[0] return spack.url.substitute_version(main_url, v) return Pkg( |