PyMaemo/Scratchboxless packaging guide
(→Building a basic debian directory) |
|||
Line 71: | Line 71: | ||
== Building a basic debian directory == | == Building a basic debian directory == | ||
- | Another useful command is ''debianize''. It will read the configuration file and write a directory named debian in the same directory. This can be used for manually creating the packages using dpkg tools directly. | + | Another useful command is ''debianize''. It will read the configuration file and write a directory named debian in the same directory. This can be used for manually creating the packages using dpkg tools directly. For a detailed usage example see the [http://github.com/astraw/stdeb#debianize-distutils-command steb page]. |
Note: sdist_dsc and bdist_deb do '''not''' use this directory, generating a new one in the source dir under deb_dist/. | Note: sdist_dsc and bdist_deb do '''not''' use this directory, generating a new one in the source dir under deb_dist/. |
Revision as of 22:42, 16 June 2010
Contents |
Introduction
The usual way of developing Maemo applications is using or Scratchbox or MADDE, which are quite heavy for Python development. An alternative is using stdeb, a set of extensions to distutils that allows generating debian packages, both binary and source, that can be installed on the device or sent to the extras-devel repository.
This tutorial will show how to integrate it into your project, building the packages and uploading it to extras-devel.
Prerequisites
This tutorial is aimed at Debian-based systems, as some stdeb commands requires the dpkg tools installed.
Also, you should get the git version of stdeb to use the debianize command, as it is a new addition and not yet available in the repositories. Run the following commands to install it:
# Clone the git repository git clone http://github.com/astraw/stdeb.git
# Enter source package cd stdeb
# Build .deb (making use of stdeb package directory in sys.path). python setup.py --command-packages=stdeb.command bdist_deb
# Install it sudo dpkg -i deb_dist/python-stdeb_0.5.1+git-1_all.deb
As only python2.5 is supported in pymaemo, it should be installed if you want to create binary packages. On Ubuntu Lucid (10.04), you can install it from this ppa, following the instructions here.
Preparing the package
As stdeb extends distutils, it is necessary that you have a working setup.py script. For our example application, which consists of a single script named "myscript" and support files like .desktop[1] and an icon[2], the setup.py will look like this:
from distutils.core import setup setup( name='myscript', version='0.1', author='Lauro Moura', author_email='lauro.neto@donotspamme.com', scripts=['myscript'], data_files=[('share/applications/hildon', ['myscript.desktop']), ('share/pixmaps', ['myscript.png'])], )
A file named stdeb.cfg in the same directory as setup.py is required, with stdeb Maemo-specific options. A detailed list of options can be found in the stdeb website.
[DEFAULT] XS-Python-Version: 2.5 # Only version currently supported by pymaemo. Package:myscript # Binary package name. stdeb adds the prefix "python-" by default Section: user/development # Section should start with user/ to appear in the menu. Depends: python-gtk2 # add extra dependencies here
Warning 1: Make sure to use an allowed section.
Warning 2: The Depends
field in stdeb.cfg will be used on your debian/control file, so you may verify if that it is filled correctly with all dependencies of your application - otherwise it will break when you try to install the package. e.g.: twcano depends on: python-simplejson, pyside-qt4-maemo5, pyside-qt4-webkit and python-twitter
, so the Depends
field should be filled this way:
Depends: python-simplejson, pyside-qt4-maemo5, pyside-qt4-webkit, python-twitter
Building the packages
The basic command is
python setup.py --command-packages=stdeb.command bdist_deb
It'll create a folder called deb_dist with the source and binary packages. Alternatively, the "sdist_dsc" command will create only the source package.
After generating, you can copy the package to your device and install it (requires an SSH server):
$ scp myscript_0.1-1_all.deb root@<n900 ip>:/root $ ssh root@<n900 ip> # dpkg -i myscript_0.1-1_all.deb
Building a basic debian directory
Another useful command is debianize. It will read the configuration file and write a directory named debian in the same directory. This can be used for manually creating the packages using dpkg tools directly. For a detailed usage example see the steb page.
Note: sdist_dsc and bdist_deb do not use this directory, generating a new one in the source dir under deb_dist/.
Uploading to extras
To upload to extras, use the debianize command and then call dpkg-buildpackage:
$ dpkg-buildpackage -rfakeroot -uc -us -S
This command will create the .dsc, .tar.gz and .changes files that can be used to upload the application to extras-devel
Future work
Support for non-Debian systems.