Bug#733489: python-apt: Improve 'Dependency' and 'BaseDependency' to get target package versions that satisfy dependencies
On 01/06/2014 04:28 PM, Julian Andres Klode wrote:
We do not support RPM. There was a fork apt-rpm but nobody
ever merged it back.
That's why I haven't heard of it in ages. ;-)
If you think they are needed, go ahead. We have some other
places using CompType() in the C++ code, though, and adding
_deb variants for them would be complicated.
BaseDependency.relation_deb would only be a nice to have. I'm more
interested in having a string that represents the original dependency
string. A property that returns something like "python (>= 2.7)" for a
BaseDependency.
Would it be okay to add something like this to BaseDependency?
Maybe BaseDependency.rawstr similar to BaseDependency.rawtype.
What do you think?
Yes, I fixed it by making
def __ne__(self, other):
- return str.__eq__(self, other) and str.__ne__(2 * self, other)
+ return not self.__eq__(other)
Thanks. That also does the trick. ^^
It's very simple. We only use __dstr("<") and __dstr(">"), so
everything works as expected this way.
It is also used for "=" to let "==" equal "=". Is that also intentional?
Can you elaborate what's the rationale behind this compatibility code?
In old python-apt versions, this was one of the cases where we returned
<< instead of <. Using this compatibility code, old code keeps working.
I see. Is this code still needed? Shouldn't all these issues be fixed in
python-apt by now...?
Furthermore the code is hard to read and so no one realized that there
was a bug in it for nearly 4 years. I personally would write it this way:
# Relation verification and replaces for compatibility '>>' with '>'
# and '<<' with '<'.
RELATION_COMPAT = {
'>>': '>', '<<': '<',
'>': '>', '<': '<',
'>=': '>=', '<=': '<=',
'=': '=', '!=': '!=',
'': '',
}
def __init__(self, name, rel, ver, pre, rawtype=None):
self.name = name
self.relation = RELATION_COMPAT[rel]
...
What do you think about this code?
Reply to: