Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Python Debian Package

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

PythonRecipes/DebianPackage - Community Ubun...

https://help.ubuntu.com/community/PythonRecipes...

Login to Edit Ubuntu Documentation > Community Documentation > PythonRecipesDebianPackage

PythonRecipesDebianPackage
Content Cleanup Required: This article should be cleaned-up to follow the content standards in the Wiki Guide. More info... Note: These instructions are only for creating packages for personal use. This method won't work for creating packages intended for submission to repositories. - For submitting to repositories, see Ubuntu packaging guide. If you are looking for a simple guide on how to create a Debian/Ubuntu package you could read http://www.debian-administration.org/articles/336 (Second part) or try stdeb tool for converting Python source packages to Debian. This Python Recipe is constantly being written, you can fix all errors in this example; feel free to do so Here is a simple example on creating a Debian Package, but it will not be in agreement with the Debian/Ubuntu Policy. You should read that if you want to publish your program in the Debian/Ubuntu repositories. In this example I will use a game called Twisted Zombie which was developed for PyWeek 5.

First step
The first thing you should know is the folder structure of the Debian Package before you create it. This folder contains three files that are very important, control, twisted-zombie and twisted-zombie.desktop.
DEBIAN/ control usr/ bin/ twisted-zombie share/ applications/ twisted-zombie.desktop pixmaps/ twisted-zombie-icon.png twisted-zombie/ data/ lib/ COPYING README.txt create-upload.py pyweek-upload.py run_game.py

twisted-zombie is the folder of the application itself, pixmaps contains an icon, application contains a desktop file that indicates some options to GNOME, and bin contains a script to execute this game from a console.

control file
In the control file, we will put a short description, long description, package name, package version, etc. Just like the output of the apt-cache show package command. The control file contains:
Package: twisted-zombie Version: 1.0 Section: games Maintainer: Manuel Kaufmann <humitos@gmail.com> Architecture: all Depends: python, python-pygame Description: Twisted Zombie game

1 of 2

Sunday 10 October 2010 10:48 PM

PythonRecipes/DebianPackage - Community Ubun...

https://help.ubuntu.com/community/PythonRecipes...

Twisted Zombie is a game developed for PyWeek 5 in seven days by programmers of Santa F Argentina.

If you wish, you can put more information about the package. In this page you can find all what you need for this: Binary package control files

twisted-zombie file
In this file we will put what command should be executed when we type twisted-zombie in a console. It's simple, it only contains the python command with the path of the main .py file. Make sure that it is executable (chmod a+x run_game.py): python /usr/share/twisted-zombie/run_game.py

twisted-zombie.desktop file
In this file we put some options about our application, to tell GNOME -or other desktop- to put our application in the menu, specifying which icon to use, what command to execute, etc...
[Desktop Entry] Encoding=UTF-8 Name=Twisted Zombie Version=1.0 Comment=Game developed for PyWeek 5 GenericName=Twisted Zombie Game Terminal=false Icon=twisted-zombie-icon.png Type=Application Exec=python /usr/share/twisted-zombie/run_game.py Categories=Game;

Config your application


If you use external files, you should include the following lines in the .py that uses those files:
import os os.chdir('/usr/share/twisted-zombie')

Build and install our package


In this step we will build our package. For this, we use the following command in the folder that contain our application: $ dpkg --build twisted-zombie/ twisted-zombie-1.0_all.deb And to finish: $ dpkg -i twisted-zombie-1.0_all.deb Done, we have installed our game in our machine. Now, open a terminal, and type twisted-zombie or go to the Application Menu -> Games -> Twisted Zombie Game and play it.

Categories: CategoryProgrammingPython
PythonRecipes/DebianPackage (last edited 2009-12-31 10:47:16 by https://login.launchpad.net/+id/EsEYTth @ mm-127-247-57-86.leased.line.mgts.by[86.57.247.127]:anatoly techtonik)

Parent Page Page History

2 of 2

Sunday 10 October 2010 10:48 PM

You might also like