Fixes #74: minor fixes to spack mirror.
This commit is contained in:
parent
539dea6411
commit
41cd8f8e6d
2 changed files with 9 additions and 2 deletions
|
@ -144,15 +144,17 @@ def mirror_list(args):
|
||||||
|
|
||||||
|
|
||||||
def _read_specs_from_file(filename):
|
def _read_specs_from_file(filename):
|
||||||
|
specs = []
|
||||||
with open(filename, "r") as stream:
|
with open(filename, "r") as stream:
|
||||||
for i, string in enumerate(stream):
|
for i, string in enumerate(stream):
|
||||||
try:
|
try:
|
||||||
s = Spec(string)
|
s = Spec(string)
|
||||||
s.package
|
s.package
|
||||||
args.specs.append(s)
|
specs.append(s)
|
||||||
except SpackError, e:
|
except SpackError, e:
|
||||||
tty.die("Parse error in %s, line %d:" % (args.file, i+1),
|
tty.die("Parse error in %s, line %d:" % (args.file, i+1),
|
||||||
">>> " + string, str(e))
|
">>> " + string, str(e))
|
||||||
|
return specs
|
||||||
|
|
||||||
|
|
||||||
def mirror_create(args):
|
def mirror_create(args):
|
||||||
|
|
|
@ -78,6 +78,7 @@ def get_matching_versions(specs, **kwargs):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
num_versions = kwargs.get('num_versions', 0)
|
num_versions = kwargs.get('num_versions', 0)
|
||||||
|
matching_spec = []
|
||||||
for i, v in enumerate(reversed(sorted(pkg.versions))):
|
for i, v in enumerate(reversed(sorted(pkg.versions))):
|
||||||
# Generate no more than num_versions versions for each spec.
|
# Generate no more than num_versions versions for each spec.
|
||||||
if num_versions and i >= num_versions:
|
if num_versions and i >= num_versions:
|
||||||
|
@ -88,7 +89,11 @@ def get_matching_versions(specs, **kwargs):
|
||||||
s = Spec(pkg.name)
|
s = Spec(pkg.name)
|
||||||
s.versions = VersionList([v])
|
s.versions = VersionList([v])
|
||||||
s.variants = spec.variants.copy()
|
s.variants = spec.variants.copy()
|
||||||
matching.append(s)
|
matching_spec.append(s)
|
||||||
|
|
||||||
|
if not matching_spec:
|
||||||
|
tty.warn("No known version matches spec: %s" % spec)
|
||||||
|
matching.extend(matching_spec)
|
||||||
|
|
||||||
return matching
|
return matching
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue