Bug#961923: python-debian: Please support easily editing debian/control

Jelmer Vernooij jelmer at debian.org
Tue Jul 7 01:10:36 BST 2020


On Sun, May 31, 2020 at 05:36:09PM +0000, Jelmer Vernooij wrote:
> On Sun, May 31, 2020 at 04:40:26PM +0100, Federico Ceratto wrote:
> > Thanks for developing python-debian.
> > It would be very nice if it could support easy and "pythonic"
> > editing of debian/control:
> > - Load the whole file into a tree of dicts and lists
> > - Allow updating it and writing to file
> > - Preserve the order of items in lists e.g. dependencies
> > 
> > This would be useful for creating linting tools similar to
> > lintian-brush.
> 
> FWIW lintian-brush actually has an interface that does this for both
> debian/control and other control files (based on python-debian). I can
> split it out into a separate module if that would be useful, though it
> should also already be usable as is:
> 
> from lintian_brush.control import ControlUpdater
> 
> with ControlUpdater('debian/control') as updater:
>     updater.source['Maintainer'] = 'Joe Example <joe at example.com>'
> 
> Will update debian/control while preserving whitespace, and will raise
> an exception when it can't.

I've now split this functionality out into a separate package that only depends
on python-debian.

The source code can be found here:

 * https://salsa.debian.org/jelmer/debmutate

and I'll be uploading it to NEW shortly.

It mostly operates as a wrapper around python-debian that adds more logic to
preserve formatting and e.g. deals with updating template files
(debian/control.in) where possible.

I'm open to the idea of piecemeal merging some of this functionality into python-debian if
Stuart prefers that.

Cheers,

Jelmer



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