PyMaemo/Scratchboxless packaging guide: Difference between revisions
imported>lmoura |
imported>amigadave add some links, categorize |
||
| Line 1: | Line 1: | ||
= Introduction = | == 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 [http://github.com/astraw/stdeb 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 | The usual way of developing Maemo applications is using or Scratchbox or [[MADDE]], which are quite heavy for Python development. An alternative is using [http://github.com/astraw/stdeb 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. | This tutorial will show how to integrate it into your project, building the packages and uploading it to extras-devel. | ||
= Preparing the package = | == 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 [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript single script] named "myscript" and support files like [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript.desktop .desktop] and an [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript.png icon], the [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/setup.py setup.py] will look like this: | As stdeb extends distutils, it is necessary that you have a working setup.py script. For our example application, which consists of a [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript single script] named "myscript" and support files like [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript.desktop .desktop] and an [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript.png icon], the [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/setup.py setup.py] will look like this: | ||
<source lang="python"> | |||
from distutils.core import setup | |||
setup( | |||
name='myscript', | |||
author='Lauro Moura', | |||
author_email='lauro.neto@donotspamme.com', | |||
scripts=['myscript'], | |||
data_files=[('share/applications/hildon', ['myscript.desktop']), | |||
('share/pixmaps', ['myscript.png'])], | |||
) | |||
</source> | |||
A file named [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/stdeb.cfg 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 [http://github.com/astraw/stdeb stdeb website]. | |||
A file named [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/stdeb.cfg stdeb. | |||
[DEFAULT] | [DEFAULT] | ||
| Line 28: | Line 28: | ||
Depends: python-gtk2 # add extra dependencies here | Depends: python-gtk2 # add extra dependencies here | ||
= Building the packages = | == Building the packages == | ||
The basic command is | The basic command is | ||
| Line 36: | Line 36: | ||
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. | 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: | After generating, you can copy the package to your device and install it (requires an [[SSH]] server): | ||
$ scp myscript_0.0.0_all.deb root@n900 ip>:/root | $ scp myscript_0.0.0_all.deb root@n900 ip>:/root | ||
| Line 42: | Line 42: | ||
# dpkg -i myscript_0.0.0_all.deb | # dpkg -i myscript_0.0.0_all.deb | ||
= 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. | ||
| Line 48: | Line 48: | ||
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/. | ||
= Uploading to extras = | == Uploading to extras == | ||
To upload to extras, use the debianize command and then call dpkg-buildpackage: | To upload to extras, use the debianize command and then call dpkg-buildpackage: | ||
| Line 54: | Line 54: | ||
$ dpkg-buildpackage -rfakeroot -uc -us -S | $ 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 | This command will create the .dsc, .tar.gz and .changes files that can be used to [[uploading to Extras-devel|upload the application to extras-devel]] | ||
= Future work = | == Future work == | ||
Support for non-debian systems. | Support for non-debian systems. | ||
[[Category:Python]] | |||
[[Category:Packaging]] | |||
Revision as of 10:55, 14 June 2010
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.
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 and an icon, the setup.py will look like this: <source lang="python"> from distutils.core import setup
setup(
name='myscript',
author='Lauro Moura',
author_email='lauro.neto@donotspamme.com',
scripts=['myscript'],
data_files=[('share/applications/hildon', ['myscript.desktop']),
('share/pixmaps', ['myscript.png'])],
) </source> 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/other # Section should start with user/ to appear in the menu. Depends: python-gtk2 # add extra dependencies here
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.0.0_all.deb root@n900 ip>:/root $ ssh root@<n900 ip> # dpkg -i myscript_0.0.0_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.
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.