1 |
Author: zmedico |
2 |
Date: 2008-10-10 20:15:43 +0000 (Fri, 10 Oct 2008) |
3 |
New Revision: 11670 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
main/trunk/pym/portage/exception.py |
8 |
Log: |
9 |
Create a new AmbiguousPackageName exception to raise from |
10 |
portage.cpv_expand(). It inherits from ValueError, for |
11 |
backward compatibility with calling code that already |
12 |
handles ValueError. |
13 |
|
14 |
|
15 |
Modified: main/trunk/pym/portage/__init__.py |
16 |
=================================================================== |
17 |
--- main/trunk/pym/portage/__init__.py 2008-10-09 23:29:54 UTC (rev 11669) |
18 |
+++ main/trunk/pym/portage/__init__.py 2008-10-10 20:15:43 UTC (rev 11670) |
19 |
@@ -6617,7 +6617,10 @@ |
20 |
else: |
21 |
virtual_name_collision = True |
22 |
if not virtual_name_collision: |
23 |
- raise ValueError, matches |
24 |
+ # AmbiguousPackageName inherits from ValueError, |
25 |
+ # for backward compatibility with calling code |
26 |
+ # that already handles ValueError. |
27 |
+ raise portage.exception.AmbiguousPackageName(matches) |
28 |
elif matches: |
29 |
mykey=matches[0] |
30 |
|
31 |
|
32 |
Modified: main/trunk/pym/portage/exception.py |
33 |
=================================================================== |
34 |
--- main/trunk/pym/portage/exception.py 2008-10-09 23:29:54 UTC (rev 11669) |
35 |
+++ main/trunk/pym/portage/exception.py 2008-10-10 20:15:43 UTC (rev 11670) |
36 |
@@ -67,6 +67,13 @@ |
37 |
class CommandNotFound(PortageException): |
38 |
"""A required binary was not available or executable""" |
39 |
|
40 |
+class AmbiguousPackageName(ValueError, PortageException): |
41 |
+ """Raised by portage.cpv_expand() when the package name is ambiguous due |
42 |
+ to the existence of multiple matches in different categories. This inherits |
43 |
+ from ValueError, for backward compatibility with calling code that already |
44 |
+ handles ValueError.""" |
45 |
+ def __str__(self): |
46 |
+ return ValueError.__str__(self) |
47 |
|
48 |
class PortagePackageException(PortageException): |
49 |
"""Malformed or missing package data""" |