* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/, gentoopm/portagepm/, gentoopm/paludispm/
@ 2011-07-10 8:48 Michał Górny
0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2011-07-10 8:48 UTC (permalink / raw
To: gentoo-commits
commit: c4d8bbba11ef1875260dc04bb588e2df1a6f3f41
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 08:49:35 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 08:49:35 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=c4d8bbba
Use a distinct exception for invalid atom.
---
gentoopm/exceptions.py | 5 +++++
gentoopm/paludispm/atom.py | 5 +++--
gentoopm/portagepm/atom.py | 5 +++--
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/gentoopm/exceptions.py b/gentoopm/exceptions.py
index 7aa237f..6f4333d 100644
--- a/gentoopm/exceptions.py
+++ b/gentoopm/exceptions.py
@@ -21,3 +21,8 @@ class AmbiguousPackageSetError(PMException):
consistenly-named set was expected.
"""
pass
+
+class InvalidAtomStringError(PMException):
+ """
+ An invalid string was passed to the atom constructor.
+ """
diff --git a/gentoopm/paludispm/atom.py b/gentoopm/paludispm/atom.py
index a67a308..85bc81e 100644
--- a/gentoopm/paludispm/atom.py
+++ b/gentoopm/paludispm/atom.py
@@ -6,6 +6,7 @@
import paludis, re
from gentoopm.basepm.atom import PMAtom
+from gentoopm.exceptions import InvalidAtomStringError
_category_wildcard_re = re.compile(r'\w')
@@ -22,12 +23,12 @@ class PaludisAtom(PMAtom):
paludis.Filter.All())
except (paludis.BadVersionOperatorError, paludis.PackageDepSpecError,
paludis.RepositoryNameError):
- raise ValueError('Incorrect atom: %s' % s)
+ raise InvalidAtomStringError('Incorrect atom: %s' % s)
def __init__(self, s, pm):
try:
self._init_atom(s, pm)
- except ValueError:
+ except InvalidAtomStringError:
# try */ for the category
self._init_atom(_category_wildcard_re.sub(r'*/\g<0>', s, 1), pm, True)
diff --git a/gentoopm/portagepm/atom.py b/gentoopm/portagepm/atom.py
index ccd272f..121e3b1 100644
--- a/gentoopm/portagepm/atom.py
+++ b/gentoopm/portagepm/atom.py
@@ -5,17 +5,18 @@
import portage.exception as pe
from portage.dbapi.dep_expand import dep_expand
-from portage.dep import Atom, match_from_list
+from portage.dep import match_from_list
from portage.versions import catsplit
from gentoopm.basepm.atom import PMAtom
+from gentoopm.exceptions import InvalidAtomStringError
class PortageAtom(object):
def __new__(self, s, pm):
try:
a = dep_expand(s, settings = pm._portdb.settings)
except pe.InvalidAtom:
- raise ValueError('Incorrect atom: %s' % s)
+ raise InvalidAtomStringError('Incorrect atom: %s' % s)
if catsplit(a.cp)[0] == 'null':
return UnexpandedPortageAtom(a)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-07-10 8:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-10 8:48 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/, gentoopm/portagepm/, gentoopm/paludispm/ Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox