summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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