Add a portdbapi.getRepositoryName() method which is the inverse of
authorZac Medico <zmedico@gentoo.org>
Sat, 6 Feb 2010 22:29:18 +0000 (22:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 6 Feb 2010 22:29:18 +0000 (22:29 -0000)
getRepositoryPath().

svn path=/main/trunk/; revision=15325

pym/portage/dbapi/porttree.py

index cf7eeac7f01b889b925b7f92c95ccbbbdfc0f64c..5a845118daad863353dbfe744e05699a325f33ce 100644 (file)
@@ -452,6 +452,18 @@ class portdbapi(dbapi):
                        return self.treemap[repository_id]
                return None
 
+       def getRepositoryName(self, canonical_repo_path):
+               """
+               This is the inverse of getRepositoryPath().
+               @param canonical_repo_path: the canonical path of a repository, as
+                       resolved by os.path.realpath()
+               @type canonical_repo_path: String
+               @returns: The repo_name for the corresponding repository, or None
+                       if the path does not correspond a known repository
+               @rtype: String or None
+               """
+               return self._repository_map.get(canonical_repo_path)
+
        def getRepositories(self):
                """
                This function is required for GLEP 42 compliance; it will return a list of