Skip to main content

Build DPKGs natively with Python.

Project description

Build Debian Packages (.deb/DPKGs) natively in Python.


Using pip:

pip install deb-constrictor


Define directories, links, scripts and dependencies:

from constrictor import DPKGBuilder

dirs = [
        'source': '~/python/beneboyit/frontend/src',
        'destination': '/srv/python/bbit-web-frontend',
        'uname': 'www-data'

maintainer_scripts = {
    'postinst': '~/python/beneboyit/frontend/scripts/after-install',
    'preinst': '~/python/beneboyit/frontend/scripts/before-install'

links =  [
        'source': '/etc/nginx/sites-enabled/bbit-web-frontend',
        'destination': '../sites-available/bbit-web-frontend'
        'source': '/etc/uwsgi/apps-enabled/bbit-web-frontend.ini',
        'destination': '../apps-available/bbit-web-frontend.ini'

depends = ('nginx', 'uwsgi')

output_directory = '~/build'

d = DPKGBuilder(output_directory, 'bbit-web-frontend', '1.5', 'all', dirs, links, maintainer_scripts)

Output file is named in the format <packagename>_<version>_<architecture>.deb and placed in the destination_dir. Alternatively, provide a name for your package as the output_name argument, and the package will be created with this name in the output_directory.

Known Issues

  • Lintian will complain about missing control file fields due to those not having the ability to be created (yet). For example copyright, changelog, extend-description, maintainer. Packages still install OK without these.
  • Can’t mark files as “config”
  • As with any tar based archive, ownership of files based on uname/gname can be wrong if the user does not exist. Use with caution or create postinst scripts to fix.

Project details

Download files

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

Files for deb-constrictor, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size deb-constrictor-0.1.6.tar.gz (5.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page