Create several Debian packages at once. Fetch the list of installed Python packages in the current virtualenv and package them as .deb packages using the standard stdeb tool. You can also:
- define the packages to create in a configuration file,
- specify options for any of these packages,
- run Python commands after archive expansion and between the creation of Debian source and the creation of the Debian package.
To create Debian packages for all currently installed Python packages, use the following command:
All options must be defined in a stdeb.cfg configuration file. In the [multideb-packages] section of stdeb.cfg, you can define extra packages to create: option name is the name of the package, option value is the required version. In the [multideb] section of stdeb.cfg, you can exclude some packages from .deb creation:
[multideb] exclude = celery django gunicorn
You can define specific options for a given package. In addition of standard stdeb options, you can also define pre_source and post_source options. Values must be an importable Python function, which will be called with the following arguments my_callable(package_name, package_version, deb_src_dir).
Here is the list of actions:
- download .tar.gz of the source code,
- expand this file,
- remove all .pyc files,
- run the pre_source function (if defined),
- run python setup.py sdist_dsc,
- run the post_source function (if defined),
- create the package with dpkg-buildpackage.
pre_source hook is called just after the expand of the archive and the removal of compiled Python files (.pyc). The current working dir is changed to this directory (for example, ./setup.py should exist) and deb_src_dir is None when this hook is called.
post_source hook is called after the sdist_dsc command. The current working dir is changed to archive directory (for example, ./setup.py should exist) and deb_src_dir is valid when this hook is called. It corresponds to the single sub-directory in the directory deb_dist.
Sample config file¶
Here is a sample stdeb.cfg file:
[multideb-packages] django = 1.8.3 [multideb] exclude = funcsigs django-allauth gunicorn [django] pre_source = multideb.remove_tests_dir [celery] post_source = multideb.fix_celery ; list of standard stdeb options [other_package] Source = debian/control Source: (Default: <source-debianized-setup-name>) Package = debian/control Package: (Default: python-<debianized-setup-name>) Suite = suite (e.g. stable, lucid) in changelog (Default: unstable) Maintainer = debian/control Maintainer: (Default: <setup-maintainer-or-author>) Section = debian/control Section: (Default: python) Epoc = version epoch Depends = debian/control Depends: Depends3 = debian/control Depends: for python3 Suggests = debian/control Suggests: Suggests3 = debian/control Suggests: for python3 Recommends = debian/control Recommends: Recommends3 = debian/control Recommends: for python3 Conflicts = debian/control Conflicts: Uploaders = uploaders Conflicts3 = debian/control Conflicts: for python3 Provides = debian/control Provides: Provides3 = debian/control Provides: for python3 Replaces = debian/control Replaces: Replaces3 = debian/control Replaces: for python3 Copyright-File = copyright file Build-Conflicts = debian/control Build-Conflicts: MIME-File = MIME file Udev-Rules = file with rules to install to udev Debian-Version = debian version (Default: 1) Build-Depends = debian/control Build-Depends: Forced-Upstream-Version = forced upstream version Upstream-Version-Suffix = upstream version suffix Stdeb-Patch-File = file containing patches for stdeb to apply XS-Python-Version = debian/control XS-Python-Version: Dpkg-Shlibdeps-Params = parameters passed to dpkg-shlibdeps Stdeb-Patch-Level = patch level provided to patch command Upstream-Version-Prefix = upstream version prefix X-Python3-Version = debian/control X-Python3-Version: MIME-Desktop-Files = MIME desktop files Shared-MIME-File = shared MIME file Setup-Env-Vars = environment variables passed to setup.py