Bug#573945: Please use the warnings system to report deprecation warnings

John Wright jsw at debian.org
Tue Mar 16 01:42:20 UTC 2010


tags 573945 + pending
thanks

On Mon, Mar 15, 2010 at 09:36:17AM +0100, Enrico Zini wrote:
> Package: python-debian
> Version: 0.1.15
> Severity: normal
> 
> Hello,
> 
> thanks for python-debian. I appreciate the importance of dropping the
> "_bundle" bit. However, the way it has been done is causing trouble: see
> #573935.
> 
> update-apt-xapian-index is run on a cronjob every week. Such warnings
> spam people. I added this code to prevent it, because python-apt was
> introducing about 2 new deprecation warnings every week, and warnings
> are useful in the terminal when you are developing, but don't belong in
> a cron job in production system:
> 
>   if options.quiet:
>     aptprogress = AptSilentProgress()
>     progress = SilentProgress()
>     warnings.filterwarnings("ignore","")
> 
> However, much to my desperation, python-debian prints the warning in
> this way:
> 
>   sys.stderr.write("WARNING: the 'debian_bundle' package is *DEPRECATED*; "
>                    "use the 'debian' package\n")
> 
> the same happens, grep told me, in deb822.py:
> 
>   print >> sys.stderr, "WARNING:",    \
>           "the 'deb822' top-level module is *DEPRECATED*,",   \
>           "please use 'debian.deb822'"

You're right, this is inconsiderate behavior on python-debian's part.  I
hadn't thought about the deprecation warning spamming users because of
reverse dependencies running in cron.  I've changed the code to use
warnings.warn instead.

> Besides this, in the last 4 months all the time I could possibly
> dedicate to apt-xapian-index has been spent chasing deprecation warnings
> being introduced all of a sudden and out of the blue by dependencies.
> 
> At least a mail to the reverse dependencies warning of things before the
> deprecation is introduced would have been really, really appreciated.

Sorry about that.  I'll send a mail out soon (I'm sorry it's not as
helpful after the fact).  We could disable the deprecation warning for
a while as well, if needed.

-- 
John Wright <jsw at debian.org>





More information about the pkg-python-debian-maint mailing list