Fix #430: edit -f fails with UnknownPackageError
- Recent external repo refactoring made `repo_for_pkg` raise an error when the package was not known. - Correct behavior is to return the highest precedence repo.
This commit is contained in:
parent
4bf57ef56f
commit
f7134990bd
@ -300,8 +300,11 @@ def repo_for_pkg(self, spec):
|
|||||||
for repo in self.repos:
|
for repo in self.repos:
|
||||||
if spec.name in repo:
|
if spec.name in repo:
|
||||||
return repo
|
return repo
|
||||||
else:
|
|
||||||
raise UnknownPackageError(spec.name)
|
# If the package isn't in any repo, return the one with
|
||||||
|
# highest precedence. This is for commands like `spack edit`
|
||||||
|
# that can operate on packages that don't exist yet.
|
||||||
|
return self.first_repo()
|
||||||
|
|
||||||
|
|
||||||
@_autospec
|
@_autospec
|
||||||
|
Loading…
Reference in New Issue
Block a user