Umang has the right answer, though perhaps not in as much detail as you might seem to need as a complete beginner.
For a Python program, you need to start by creating a setup.py
file. The bulk of the file will be a call to distutils.core.setup
- this is discussed in detail in part 2 of the distutils documentation.
All other packaging systems for Python (such as py2exe, setuptools, or Distribute) build on top of the distutils
package, usually by extending setup()
in some way (with additional parameters or commands).
Before converting this into an Ubuntu package, you can test the setup script by running sudo setup.py install
. It should install the files into their expected locations; if it doesn't you may need to check your configuration. In particular, sections 2.5 (scripts) and 2.6 (package data) of the distutils
documentation probably apply to your situation.
Once that's done, you can then look at layering on the Ubuntu packaging according to the Ubuntu Packaging Guide for Python. The python-stdeb
and python-mkdebian
tools suggested by Umang simplify the generation of the various files required for Ubuntu packaging.