Skip to main content

Add support for i18n, documentation and icons to distutils

Project description

distutils-extra can be used with python’s distutils or the enhanced setuptools.


To make use of the distutils extenstions, you have to import the corresponding methods at the beginning of your

from DistUtilsExtra.command import *

Furthermore you have to map the methods to the extended ones:

cmdclass = { "build" : build_extra.build_extra, "build_i18n" :  build_i18n.build_i18n }

If you have replaced the default build command by build_extra and defined the other commands e.g. build_i18n, the sub commands e.g. will be called automatically. There is no need to enable them in the setup.cfg anymore (This was require in a previous version). Disabling imported commands in the setup.cfg is still possible:


See the setup.cfg.example for a more complex layout.

Currently there are the following extensions available:

build_extra: initiates the extensions
build_i18n: provides gettext integration
build_icons: installs icons
build_help: installs a docbook based documentation


Just enable the corresponding build target in the setup.cfg:


No further imports or modifications are required.

I hope that this code could help you to make your live easier,


This module provides a setup() method for distutils and DistUtilsExtra which infers as many setup() arguments as possible. The idea is that your only needs to have the metadata and some tweaks for unusual files/paths, in a “convention over configuration” paradigm.

This currently supports:

- Python modules (./*.py, only in root directory)
- Python packages (all directories with
- GtkBuilder (*.ui)
- Qt4 user interfaces (*.ui)
- D-Bus (*.conf and *.service)
- PolicyKit (*
- Desktop files (*
- KDE4 notifications (*
- scripts (all in bin/, and ./<projectname>
- Auxiliary data files (in data/*)
- automatic po/ (with all source files which contain _())
- automatic MANIFEST (everything except swap and backup files, *.pyc, and revision control)
- manpages (*.[0-9])
- files which should go into /etc (./etc/*, copied verbatim)
- determining "requires" from import statements in source code
- determining "provides" from shipped packages and modules

If you follow above conventions, then you don’t need any po/, ./setup.cfg or ./, and just need the project metadata (name, author, license, etc.) in ./

Author: Henry Fuheng Wu, Sebastian Heinlein, Martin Pitt

Project details

Download files

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

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page