Makes sense. Thanks for the response!
Control: notfound -1 2.6.0ubuntu1 Control: found -1 2.6.0 On Mon, Oct 09, 2023 at 08:03:44AM -0400, Jonathan Kamens wrote:Package: python3-apt Version: 2.6.0ubuntu1 Severity: normal My use case of apt.package.Package.get_changelog needs to know whether a changelog failed to download because it is not available on the server vs. it failed because of a connectivity issue with the server. Right now the function completely masks that information, simply returning a string in both cases. I can't try to parse the string to extract the information because it's not always explicit and because it's internationalized so that's a whole can of worms. I know you probably can't change the default behavior of the get_changelog function because too many things depend on it, but two other options would be to (a) add a lower-level function that just tries to do the download and lets exceptions bubble up instead of catching them and turning them into strings, or (b) add a keyword argument to get_changelog which enables bubbling up exceptions instead of converting them to strings.I'm afraid that this is not an option. I noticed the code is currently using Python URL downloading facilities which is a bug, it should be using apt_pkg.Acquire instead (and really it should use APT's native changelog support instead of partially badly reimplementing it). APT's error handling meanwhile does not have error codes or anything so all you get back is an apt_pkg.Error which is not going to help you. This is something I want to address for the APT 3.0 API break in April so it's possible that we can have this addressed in 9 months or so, but it's not a priority as people should not be using the 'apt' set of Python modules anyhow, but use apt_pkg directly; and the fix essentially will be adding apt_pkg.AcquireChangelog class and may not involve any changes to apt.package. There is a limited set of utility functions that we should make available on top of apt_pkg, and then we really need to raise DeprecationWarning. People write so many broken incredibly slow code by using the apt modules that it is not funny. The API is utterly misleading and destructive.