1 |
Author: zmedico |
2 |
Date: 2010-02-06 22:29:18 +0000 (Sat, 06 Feb 2010) |
3 |
New Revision: 15325 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/dbapi/porttree.py |
7 |
Log: |
8 |
Add a portdbapi.getRepositoryName() method which is the inverse of |
9 |
getRepositoryPath(). |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/dbapi/porttree.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/dbapi/porttree.py 2010-02-05 23:39:19 UTC (rev 15324) |
15 |
+++ main/trunk/pym/portage/dbapi/porttree.py 2010-02-06 22:29:18 UTC (rev 15325) |
16 |
@@ -452,6 +452,18 @@ |
17 |
return self.treemap[repository_id] |
18 |
return None |
19 |
|
20 |
+ def getRepositoryName(self, canonical_repo_path): |
21 |
+ """ |
22 |
+ This is the inverse of getRepositoryPath(). |
23 |
+ @param canonical_repo_path: the canonical path of a repository, as |
24 |
+ resolved by os.path.realpath() |
25 |
+ @type canonical_repo_path: String |
26 |
+ @returns: The repo_name for the corresponding repository, or None |
27 |
+ if the path does not correspond a known repository |
28 |
+ @rtype: String or None |
29 |
+ """ |
30 |
+ return self._repository_map.get(canonical_repo_path) |
31 |
+ |
32 |
def getRepositories(self): |
33 |
""" |
34 |
This function is required for GLEP 42 compliance; it will return a list of |