diff options
Diffstat (limited to 'lib/spack/spack/repository.py')
-rw-r--r-- | lib/spack/spack/repository.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/spack/spack/repository.py b/lib/spack/spack/repository.py index d77700c01f..1536ecb0e6 100644 --- a/lib/spack/spack/repository.py +++ b/lib/spack/spack/repository.py @@ -337,8 +337,16 @@ class RepoPath(object): return self.repo_for_pkg(pkg_name).filename_for_package_name(pkg_name) def exists(self, pkg_name): + """Whether package with the give name exists in the path's repos. + + Note that virtual packages do not "exist". + """ return any(repo.exists(pkg_name) for repo in self.repos) + def is_virtual(self, pkg_name): + """True if the package with this name is virtual, False otherwise.""" + return pkg_name in self.provider_index + def __contains__(self, pkg_name): return self.exists(pkg_name) @@ -772,6 +780,10 @@ class Repo(object): filename = self.filename_for_package_name(pkg_name) return os.path.exists(filename) + def is_virtual(self, pkg_name): + """True if the package with this name is virtual, False otherwise.""" + return self.provider_index.contains(pkg_name) + def _get_pkg_module(self, pkg_name): """Create a module for a particular package. |