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.

1. DISTUTILS

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

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:

[build]
i18n=False

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

2. SETUPTOOLS

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

[build]
i18n=True
help=True
icons=True

No further imports or modifications are required.

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

3. DistUtilsExtra.auto

This module provides a setup() method for distutils and DistUtilsExtra which infers as many setup() arguments as possible. The idea is that your setup.py 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 __init__.py)
- GtkBuilder (*.ui)
- Qt4 user interfaces (*.ui)
- D-Bus (*.conf and *.service)
- PolicyKit (*.policy.in)
- Desktop files (*.desktop.in)
- KDE4 notifications (*.notifyrc.in)
- scripts (all in bin/, and ./<projectname>
- Auxiliary data files (in data/*)
- automatic po/POTFILES.in (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/POTFILES.in, ./setup.cfg or ./MANIFEST.in, and just need the project metadata (name, author, license, etc.) in ./setup.py.


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

distutils_extra_python-2.39.2-py3-none-any.whl (20.7 kB view hashes)

Uploaded Python 3

Supported by

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