summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-02-09 08:57:27 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2016-02-09 08:57:27 -0800
commitf7134990bd9551d6361fb57db7095fa3bf44e092 (patch)
tree8d21b833a8337f03f1357800f1510e15ff606e75
parent4bf57ef56f1a4bdc0b95c7f39391a71b3cc834c2 (diff)
downloadspack-f7134990bd9551d6361fb57db7095fa3bf44e092.tar.gz
spack-f7134990bd9551d6361fb57db7095fa3bf44e092.tar.bz2
spack-f7134990bd9551d6361fb57db7095fa3bf44e092.tar.xz
spack-f7134990bd9551d6361fb57db7095fa3bf44e092.zip
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.
-rw-r--r--lib/spack/spack/repository.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/spack/spack/repository.py b/lib/spack/spack/repository.py
index b5df1168b6..f58cd52125 100644
--- a/lib/spack/spack/repository.py
+++ b/lib/spack/spack/repository.py
@@ -300,8 +300,11 @@ class RepoPath(object):
for repo in self.repos:
if spec.name in 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