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.
This commit is contained in:
parent
ec720bf28d
commit
296d58ef6b
3 changed files with 3 additions and 3 deletions
|
@ -1239,7 +1239,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)
|
||||
|
|
|
@ -763,7 +763,7 @@ def url_for_version(self, version):
|
|||
# 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:
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue