[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#733489: python-apt: Improve 'Dependency' and 'BaseDependency' to get target package versions that satisfy dependencies



On Mon, Jan 06, 2014 at 03:43:25PM +0100, Michael Schaller wrote:
> 
> On 01/06/2014 02:04 PM, Julian Andres Klode wrote:
> >Outside the Debian world, the Debian style is not used. The style
> >used here is just the common ASCII mathematical notation.
> 
> Oh. Right!
> Now that you mention it APT also supports RPMs and thus it would
> make sense to use the math-notation. Got it! Thanks!

We do not support RPM. There was a fork apt-rpm but nobody
ever merged it back.

> >
> >No. It would have to be in both.
> 
> Right. Makes sense. So you would propose to add the properties
> apt_pkg.Dependency.comp_type_deb and
> apt.package.BaseDependency.relation_deb?

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.

> >
> >Fixed. And it also uses !=, apt's source code tells me.
> 
> Makes sense. Thanks for updating the documentation. I have one
> nitpick though... apt_pkg.Dependency doesn't list "<".

Fixed. I updated all lists everywhere so the dependencies are
sorted now.

> >
> >>Can it be that apt.package.BaseDependency.__dstr has a bug?
> >>Shouldn't __ne__ only use __ne__ calls?
> >>If you ask me then:
> >>def __ne__(self, other):
> >>     return str.__eq__(self, other) and str.__ne__(2 * self, other)
> >>
> >>should be:
> >>def __ne__(self, other):
> >>     return str.__ne__(self, other) and str.__ne__(2 * self, other)
> >>
> You didn't answer this one. Do you think this is a bug?

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)


> 
> >>
> >>Am I the only one who thinks that apt.package.BaseDependency.__dstr
> >>is a really weird helper? Why not just use a dict and translate all
> >>possible strings to the expected strings? That would IMHO increase
> >>the readability and would only make the expected strings available.
> >
> >I don't know. I did not write IIRC.
> >
> Actually you did write it. ;-)
> http://anonscm.debian.org/gitweb/?p=apt/python-apt.git;a=commit;h=28fcce3fe36ab2c3855d4c3766490272a7310392

It's very simple. We only use __dstr("<") and __dstr(">"), so 
everything works as expected this way.

> 
> 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.

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Please do not top-post if possible.


Reply to: