Skip to content
/ stdeb Public
forked from astraw/stdeb

produces Debian source packages from Python packages

License

Notifications You must be signed in to change notification settings

avnik/stdeb

 
 

Repository files navigation

stdeb - Python to Debian source package conversion utility

stdeb produces Debian source packages from Python packages via a new distutils command, sdist_dsc. Automatic defaults are provided for the Debian package, but many aspects of the resulting package can be customized via a configuration file. An additional command, bdist_deb, creates a Debian binary package, a .deb file.

All methods eventually result in a call to the sdist_dsc distutils command. You may prefer to do so directly:

python -c "import stdeb; execfile('setup.py')" sdist_dsc

Alternatively, two scripts are provided:

stdeb_run_setup [options] # calls "python setup.py sdist_dsc [options]"

py2dsc [options] mypackage-0.1.tar.gz # uses pre-built Python source package

In all cases, a Debian source package is produced from unmodified Python packages. The following files are produced in a newly created subdirectory deb_dist:

  • packagename_versionname.orig.tar.gz
  • packagename_versionname-debianversion.dsc
  • packagename_versionname-debianversion.diff.gz

These can then be compiled into binary packages using the standard Debian machinery (e.g. dpkg-buildpackage).

Also, a bdist_deb distutils command is installed. This calls the sdist_dsc command and then runs dpkg-buildpackage on the result:

python -c "import stdeb; execfile('setup.py')" bdist_deb

Do this from the directory with your setup.py file:

python -c "import stdeb; execfile('setup.py')" bdist_deb

This will make a Debian source package (.dsc, .orig.tar.gz and .diff.gz files) and then compile it to a Debian binary package (.deb) for your current system. The result will be in deb_dist.

Warning: installing the .deb file on other versions of Ubuntu or Debian than the one on which it was compiled will result in undefined behavior. If you have extension modules, they will probably break. Even in the absence of extension modules, bad stuff will likely happen.

For this reason, it is much better to build the Debian source package and then compile that (e.g. using Ubuntu's PPA) for each target version of Debian or Ubuntu.