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

Jelmer Vernooij jelmer at debian.org
Sun May 31 18:36:09 BST 2020


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.

Jelmer



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