A cookiecutter template to make a Debian package from an application's existing Python package as released to PyPI or a private repository. It creates a project to build a self-contained Python virtualenv wrapped into a Debian package (an "omnibus" package, all passengers on board). The packaged virtualenv is kept in sync with the host's interpreter automatically.
See spotify/dh-virtualenv for more details, and 1and1/debianized-sentry for an example project.
The similar dh-virtualenv-mold adds packaging metadata to an existing Python project under your control. That one should also be used when you want to contribute Debian packaging to an upstream project.
In case you don't have the cookiecutter
command line tool yet, here's
how to install it.
Creating the packaging project goes like this (make sure you're in a suitable directory like ~/src
):
cookiecutter https://github.com/Springerle/debianized-pypi-mold.git
cd ‹projectname›
dch -r "" # add a proper distro and date to the changelog
It makes sense to git init
the created directory directly afterwards, and git add
all files,
so that you have the template version of files saved in the git staging area.
Do that before any additional files are generated, that you don't want to have in your repository.
Next check all the files for necessary changes regarding the software your're packaging.
The template makes some assumptions that often fit, but there's always some differences in details.
Delete anything you do not need, e.g. from the list of build dependencies.
Search for TODO
to make sure you did not overlook things that typically have to be changed.
For Python3, you should look into the files debian/control
and debian/*.triggers
,
and adapt them accordingly.
The license used for the packaging project is “BSD 3-clause”, change the LICENSE
file and “BSD” references in README.md
and setup.py
as needed.
See the template's README for more information on how to actually build the DEB package.