Custom Search

Thursday, April 3, 2014

How to Create Debian Package for Python Application

1)
Clone the project
#git clone https://github.com/sajuptpm/python-smpplib.git
#cd python-smpplib

2)
Create "debian" folder
#mkdir debian




3)
Create "debian/changelog" file
#dch --create

4)
Create an empty copyright File
#vim debian/copyright

5)
Create an empty compat File
#vim debian/compat

6)
Create an empty rules File
#vim debian/rules

7)
Create an empty rules File
#vim debian/control

8)
Try to build the package
#dpkg-buildpackage -b

9)
Edit control File and add following lines
#vim debian/control
Source: python-smpplib
Maintainer: Developer

Package: python-smpplib
Architecture: all

10)

Try to build the package
#dpkg-buildpackage -b

11)

Edit rules file and add following lines
#vim debian/rules
#!/usr/bin/make -f

%:
        dh $@ --with python2


12)

Try to build the package
#dpkg-buildpackage -b

13)

Edit compat file add add following line
#vim debian/compat
10


14)

Try to build the package
#dpkg-buildpackage -b

15)

Try to install the application from resultant debian Package
#cd ../
#dpkg -i python-smpplib_1_all.deb
#python
>>> import smpplib


16)

Remove/Uninstall the installed application
#sudo dpkg --purge python-smpplib
#python
>>> import smpplib


17)

Try Install the application using setup.py command
#sudo python setup.py install
#python
>>> import smpplib


18)

Remove/Uninstall the installed application
#sudo pip uninstall python-smpplib
#python
>>> import smpplib

6 comments:

  1. http://askubuntu.com/questions/90764/how-do-i-create-a-deb-package-for-a-single-python-script

    ReplyDelete
  2. http://python-packaging-user-guide.readthedocs.org/en/latest/

    ReplyDelete
  3. http://www.laurentluce.com/posts/hello-world/ <--Django

    https://www.digitalocean.com/community/articles/how-to-package-and-distribute-python-applications <--- Flask

    http://www.diveintopython3.net/packaging.html <---diveintopython3

    ReplyDelete
  4. https://wiki.debian.org/Python/Packaging

    http://www.wefearchange.org/2010/05/from-python-package-to-ubuntu-package.html

    http://python-packaging-user-guide.readthedocs.org/en/latest/ <=== IMP

    http://askubuntu.com/questions/90764/how-do-i-create-a-deb-package-for-a-single-python-script <=====

    http://savetheions.com/2010/01/20/packaging-python-applicationsmodules-for-debian/

    http://guide.python-distribute.org/

    https://www.debian.org/doc/packaging-manuals/python-policy/

    http://blog.garethj.com/2009/06/02/building-deb-packages-for-python-applications/

    http://www.laurentluce.com/posts/hello-world/ <--Django

    https://www.digitalocean.com/community/articles/how-to-package-and-distribute-python-applications <--- Flask

    http://www.diveintopython3.net/packaging.html <---diveintopython3

    ReplyDelete
  5. debhelper
    ############

    1)
    https://joeyh.name/code/debhelper/

    debhelper is a "collection of programs" that can be used in a "debian/rules" file to automate common tasks related to building binary debian packages. Programs are included to install various files into your package, compress files, fix file permissions, integrate your package with the debian menu system, etc


    http://man.he.net/man7/debhelper

    2)
    IntroDebianPackaging
    https://wiki.debian.org/IntroDebianPackaging
    http://en.wikipedia.org/wiki/Debian_build_toolchain

    3)
    Debian "rules" files
    http://stackoverflow.com/tags/debhelper/info
    At the lowest level, rules files are just Makefiles.

    4)
    Video
    http://showmedo.com/videotutorials/video?name=linuxJensMakingDeb#

    4)
    console-script
    http://docs.openstack.org/developer/pbr/#entry-points

    ReplyDelete
  6. How to get debian packaging script of an application "python-heatclient"

    #sudo apt-get source python-heatclient

    ReplyDelete