Skip to main content

manipulation of Debian package control files

Project description

Debmutate is a set of Python modules for manipulating the control files of Debian packages, with the ability to preserve the existing formatting of the control files.

It's built on top of the excellent python-debian library, and was originally extracted from lintian-brush.

To modify one of the control files, use one of the context managers to edit the file.

For example, for debian/control:

from debmutate.control import ControlEditor

with ControlEditor(path='debian/control') as control:
    print(control.source['Maintainer'])
    control.source['Maintainer'] = "Jelmer Vernooij <jelmer@debian.org>"

Or for debian/changelog:

from debmutate.changelog import ChangelogEditor

with ChangelogEditor(path='debian/changelog') as editor:
   editor.add_entry(['Some entry'])

Once you leave the context manager, the changes will be written to disk if there were any. If the editor is unable to preserve the formatting of the control file, it will raise a FormattingUnpreservable error.

If the control file that was edited was generated from another control file (e.g. debian/control.in), debmutate will attempt to update that file instead and then regenerate debian/control. If it is unable to do so, it will raise a GeneratedFile exception.

The file will be left as-is if an exception is raised, or if the .cancel() method is called.

debmutate currently provides editors for the following control files:

  • debian/changelog
  • debian/copyright
  • debian/control
  • debian/patches/series
  • debian/tests/control
  • debian/watch
  • debian/maintscripts, debian/*.maintscripts
  • debian/source/lintian-overrides, debian/*.lintian-overrides
  • debian/debcargo.toml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debmutate-0.69.tar.gz (70.5 kB view details)

Uploaded Source

File details

Details for the file debmutate-0.69.tar.gz.

File metadata

  • Download URL: debmutate-0.69.tar.gz
  • Upload date:
  • Size: 70.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for debmutate-0.69.tar.gz
Algorithm Hash digest
SHA256 8a3d46cc5ecd6ec4686233c61e8077bcf26a40f20ea05f5b09b97ee52fa71fb2
MD5 d3bada9366132283db666ea6ed9f9961
BLAKE2b-256 be2ec71a285ff3e0159f1fff1ccc37cb113c29b41e8ca3f75f129c519ee6f8e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page