Is there a standard way to create Debian packages for distributing Python programs?

mac picture mac · Aug 18, 2011 · Viewed 29.4k times · Source

There is a ton of information on how to do this, but since "there is more than one way to skin a cat", and all the tutorials/manuals that cover a bit of the process seem to make certain assumptions which are different from other tutorials, I still didn't manage to grasp it.

So far this is what I think I understood.

  1. My final goal should be that of creating a "binary" .deb package. Such package will be platform-independent (32/64 bit) as all Python programs are such.
  2. To create a "binary" package I need first to create a source package.
  3. To create the source package I can use either CDBS or debhelper. Debhelper is the recommended way for beginners.
  4. The core of creating a source package is populating the DEBIAN directory in the source directory with a number of files clarifying where files need to be copied, what copyright and licensing scheme they are subject to, what dependencies they have, etc...
  5. Step #4 can be largely automated the dh_makecommand if the Python source also comes with a distutils' setup.py script.

Now my questions:

  1. Is my understanding of the process correct? Is there anything I am missing, or anything that I got wrong?
  2. Step #5 is really the more confusing to me: specifically the two points that remains most obscure to me are:
    • How do I write a setup.py script that install a stand-alone programme? EDIT: By standalone programme I mean a program intended to be used by a desktop user (as opposed to a module which I understand like a collection of functionality to be used by other software after having been imported). In my specific case I would actually need two such "programs": the main software and a separate utility (in effect a second "program" that should be in the same package with the other one).
    • What are the specificities of such a script for DEB packages? The official documentation only seems to deal with RPM and Windows stuff...

BTW: These are the best sources of information that I could find myself so far. If you have anything better than this, please share! :)

Answer

Ross Patterson picture Ross Patterson · Aug 18, 2011

It looks like stdeb will do what you want.

Also, for installing scripts, I strongly recommend distribute's console_scripts entry point support.