1. sudo apt-get install python-stdeb devscripts python-all-dev
2. sudo pip install -U stdeb
3. python setup.py --command-packages=stdeb.command bdist_deb
4. The *.deb , *.tar.gz , *.dsc will be generated under deb_dist/ directory.
PS. If I have my own debian/*.postinst , debian/*.postrm , ...etc.
I need to add the file into MANIFEST.in in the same level directory with setup.py .
Such as:
$ echo "include debian/*" >> MANIFEST.in
Reference:
https://wiki.debian.org/Python/Packaging