[pkgcore] #230: pkgcore/config/errors.py DeprecationWarning etc

0 views
Skip to first unread message

pkgcore

unread,
Apr 5, 2009, 4:21:57 AM4/5/09
to pkgco...@googlegroups.com
#230: pkgcore/config/errors.py DeprecationWarning etc
------------------------+---------------------------------------------------
Reporter: djanderson | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: pkgcore | Version: 0.4.7.16
Keywords: |
------------------------+---------------------------------------------------
There are a few small problems in config/errors.py:

Most of the problems stem from this:
[http://www.python.org/dev/peps/pep-0352/]

1) Use of {{{class BaseException(Exception):}}}. From Python 2.5 onward,
BaseException is the name of Python's base exception, which includes
Exception in this manner:
{{{
- BaseException
|- KeyboardInterrupt
|- SystemExit
|- Exception
|- (all other current built-in exceptions)
}}}
So even though pkgcore normally calls this as errors.BaseException, I
think it would be better to use a different name like PkgcoreException or,
since it's an empty exception, just raise Exception('something') directly
in the code that currently raises BaseException and inherit Exception
instead of BaseException in TypeDefinition and ConfigutationException.

2) The use of self.message is deprecated.
Steps to reproduce:
{{{
# echo "=in-valid/atom" >>/etc/portage/package.keywords
# pmerge
/usr/lib/python2.6/site-packages/pkgcore/config/errors.py:88:
DeprecationWarning: BaseException.message has been deprecated as of Python
2.6
self.message = message
/usr/lib/python2.6/site-packages/pkgcore/config/errors.py:97:
DeprecationWarning: BaseException.message has been deprecated as of Python
2.6
if self.message is not None:
Error in configuration:
Instantiating default domain 'livefs domain':
Caught exception "domain failure: failed reading
'/etc/portage/package.keywords': atom '=in-valid/atom' is malformed: error
operator requires a version" instantiating pkgcore.ebuild.domain.domain
}}}
Not sure how to best deal with that, but I might recommend a little less
is more in this situation, maybe just: "!!! failed reading
'/etc/portage/package.keywords': atom '=in-valid/atom' is malformed:
operator requires a version" would be more than enough information.

--
Ticket URL: <http://www.pkgcore.org/trac/pkgcore/ticket/230>
pkgcore <http://www.pkgcore.org/trac/pkgcore>
pkgcore package manager

pkgcore

unread,
Oct 18, 2009, 11:53:05 PM10/18/09
to pkgco...@googlegroups.com
#230: pkgcore/config/errors.py DeprecationWarning etc
-------------------------+--------------------------------------------------
Reporter: djanderson | Owner:
Type: defect | Status: closed
Priority: normal | Milestone:
Component: pkgcore | Version: 0.4.7.16
Resolution: fixed | Keywords:
-------------------------+--------------------------------------------------
Changes (by ferringb):

* status: new => closed
* resolution: => fixed


Comment:

for #1, the reasoning for deriving from a base exception is the same
reason they rebased their exceptions to BaseException- ability to grab the
master/true-parent-exception, and intercept all exceptions of that class.

That said, renaming it isn't too hard- it's now BaseError (name fits the
derivatives format better also).

As for #2, can't replicate the warning. The "less is more" bit does
apply, just need to do some serious reshuffling of pmerge code (and
exception pass down) to make that prettier...

Marking fixed for #1, and due to not being able to replicate #2...

--
Ticket URL: <http://www.pkgcore.org/trac/pkgcore/ticket/230#comment:1>

Reply all
Reply to author
Forward
0 new messages