1 |
Author: zmedico |
2 |
Date: 2008-10-10 20:33:08 +0000 (Fri, 10 Oct 2008) |
3 |
New Revision: 11672 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Migrate code from plain ValueError to AmbiguousPackageName where appropriate |
9 |
(inherits from ValueError for backward compatibility). |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/_emerge/__init__.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/_emerge/__init__.py 2008-10-10 20:25:19 UTC (rev 11671) |
15 |
+++ main/trunk/pym/_emerge/__init__.py 2008-10-10 20:33:08 UTC (rev 11672) |
16 |
@@ -4731,10 +4731,7 @@ |
17 |
|
18 |
if debug: |
19 |
print "Exiting...", jbigkey |
20 |
- except ValueError, e: |
21 |
- if not e.args or not isinstance(e.args[0], list) or \ |
22 |
- len(e.args[0]) < 2: |
23 |
- raise |
24 |
+ except portage.exception.AmbiguousPackageName, e: |
25 |
pkgs = e.args[0] |
26 |
portage.writemsg("\n\n!!! An atom in the dependencies " + \ |
27 |
"is not fully-qualified. Multiple matches:\n\n", noiselevel=-1) |
28 |
@@ -8031,8 +8028,8 @@ |
29 |
expanded_atoms = non_virtual_atoms |
30 |
if len(expanded_atoms) > 1: |
31 |
# compatible with portage.cpv_expand() |
32 |
- raise ValueError([portage.dep_getkey(x) \ |
33 |
- for x in expanded_atoms]) |
34 |
+ raise portage.exception.AmbiguousPackageName( |
35 |
+ [portage.dep_getkey(x) for x in expanded_atoms]) |
36 |
if expanded_atoms: |
37 |
atom = expanded_atoms[0] |
38 |
else: |
39 |
@@ -10556,7 +10553,7 @@ |
40 |
# what will and will not get unmerged |
41 |
try: |
42 |
mymatch = vartree.dbapi.match(x) |
43 |
- except ValueError, errpkgs: |
44 |
+ except portage.exception.AmbiguousPackageName, errpkgs: |
45 |
print "\n\n!!! The short ebuild name \"" + \ |
46 |
x + "\" is ambiguous. Please specify" |
47 |
print "!!! one of the following fully-qualified " + \ |
48 |
@@ -11783,7 +11780,7 @@ |
49 |
print |
50 |
try: |
51 |
pkgs = trees[settings["ROOT"]]["vartree"].dbapi.match(myfiles[0]) |
52 |
- except ValueError, e: |
53 |
+ except portage.exception.AmbiguousPackageName, e: |
54 |
# Multiple matches thrown from cpv_expand |
55 |
pkgs = e.args[0] |
56 |
if len(pkgs) == 0: |
57 |
@@ -12115,7 +12112,7 @@ |
58 |
return |
59 |
try: |
60 |
atom = portage.dep_expand(x, mydb=vardb, settings=settings) |
61 |
- except ValueError, e: |
62 |
+ except portage.exception.AmbiguousPackageName, e: |
63 |
msg = "The short ebuild name \"" + x + \ |
64 |
"\" is ambiguous. Please specify " + \ |
65 |
"one of the following " + \ |
66 |
@@ -14024,7 +14021,7 @@ |
67 |
try: |
68 |
valid_atoms.append( |
69 |
portage.dep_expand(x, mydb=vardb, settings=settings)) |
70 |
- except ValueError, e: |
71 |
+ except portage.exception.AmbiguousPackageName, e: |
72 |
msg = "The short ebuild name \"" + x + \ |
73 |
"\" is ambiguous. Please specify " + \ |
74 |
"one of the following " + \ |