Writing Python scripts for MeeGo is easy. But how do you package a
Python script in an RPM other MeeGo users can install?
It turned out to be far easier than I expected. Python and Ubuntu had
all the tools I needed.
First you'll need a .desktop file describing your app, if you don't
already have one. This gives window managers the information they
need to show your icon and application name so the user can run it.
Here's the one I wrote for PyTopo:
Of course, you'll also want a desktop icon. Most other applications on
MeeGo seemed to use 48x48 pixel PNG images, so that's what I made,
though it seems to be quite flexible -- an SVG is ideal.
With your script, desktop file and an icon, you're ready to create
Create a setup.py file describing your package, as in the
simple example or the more detailed
setup script page.
For a sample standalone script with a desktop file and icon, you can
take a look at my
Starting from the Python setup script,
RPM or even Windows packages -- assuming you
have the appropriate tools installed on your machine.
I'm on an Ubuntu (Debian-based) machine, and all the docs imply you
have to be on an RPM-based distro to make an RPM. Happily, that's not
true: Ubuntu has RPM tools you can install.
$ sudo apt-get install rpm
Then let Python do its thing:
$ python setup.py bdist_rpm
Python generates the spec file and everything else needed and builds
a multiarch RPM that's ready to install on MeeGo.
You can install it by copying it to the MeeGo device with
scp dist/PyTopo-1.0-1.noarch.rpm email@example.com:/tmp/.
Then, as root on the device, install it with
rpm -i /tmp/PyTopo-1.0-1.noarch.rpm.
To see a working example, you can browse my latest
(only what's in SVN; it needs a few more tweaks before it's ready for
a formal release). Or try the RPM I made for MeeGo:
I'd love to hear whether this works on other RPM-based distros.
What about Debian packages?
Curiously, making a Debian package on Debian/Ubuntu is much less
straightforward even if you're starting on a Debian/Ubuntu machine.
Distutils can't do it on its own.
Python package recipe, but it begins with a caution that you
shouldn't use it for a package you want to submit.
For that, you probably have to wade through the
Packaging Guide. Clearly, that will need a separate article.
[ 18:44 May 20, 2011
More programming |
permalink to this entry |
Over the past week I've been playing with the MeeGo ExoPC tablet,
experimenting with the various options for building programs.
One advantage MeeGo has over Android or iOS is that there are quite
a lot of language and toolkit options. If you have an existing program,
especially if it runs on Linux, you can probably
find a way to port it to MeeGo fairly without much extra coding.
But since MeeGo is still quite new, not all of the options work quite
as well as you might hope -- yet. I'm sure they'll get better, but
here's what the development climate looks like now.
C++, Qt and Meego SDK
C++ and Qt are the primary supported environment on MeeGo, via the
MeeGo SDK, run in an IDE called QtCreator.
The documentation turns out to be somewhat incomplete; I'll write
up a howto as a separate article.
But once you get it installed (much easier than installing,
say, Eclipse for Android), it runs nicely. You can use normal Qt, not
a specialized environment, so existing Qt programs should be quick
to port, and the IDE takes care of packaging, copying the app to your
remote device and starting it running. Very painless.
Testing apps locally isn't so easy. They're set up to use QEMU,
which only works if your development machine has hardware virtualization.
Supposedly there's a way to make this work in virtualbox (which doesn't
require hardware virtualization), but the docs don't address how.
Still, testing on the target device is easy.
Unfortunately, not many of my existing programs are C++ and Qt.
Update: I should have mentioned that QtCreator also lets you program in QML,
an XML-like language that lets you design Qt user interface and
even write application code.
Web Apps under C++ and QWebView
So what about those web apps?
Since the C++ SDK was so well supported, I figured, why not use a
Unfortunately QWebView turns out to be tricky to use, has very
few sample apps available, and so far I've been unable to get it to
work under MeeGo at all.
Nokia Web RunTime
And anyway, for pure web apps, there's a kit explicitly for that:
WRT, the Nokia Web RunTime. But it's pretty heavyweight: the official
apps? Seriously?) and a required set of Nokia libraries that I had
But WRT apps are packaged according to the
W3C Widget Packaging and
Configuration specification -- so it's probably possible to
roll your own without the big Nokia WRT package.
More research required.
Python, Qt and PySide
I have a lot of Python apps, so I was very happy to see that
Python comes already
installed on MeeGo. (Perl is also supported; Ruby theoretically
is but it's not installed by default.)
Since Qt is the officially blessed user interface,
Python-Qt seems like the way to go.
Except -- Python in MeeGo has no Qt bindings installed.
The package that provides them is called
PySide, but depending on
where you look you'll either be steered toward a lengthy source
compile on the MeeGo device, or a zypper install from someone's
None of that is difficult for developers, but you can't expect users
to enable experimental repositories or compile from source. Is PySide going to
be a standard part of MeeGo by the time it ships to users? Nobody's saying.
It makes me leery of putting much energy into Python-Qt development
until I hear more.
A little frustrated with the options so far,
I was idly poking around an interactive Python session and typed
>>> import gtk
And it worked! Even though Qt is the supported UI toolkit and nobody talks
about GTK, it's installed on MeeGo -- complete with Python bindings.
It gave two deprecation warnings, but what's a little deprecation
A simple test program ran just fine.
So I whipped up a starter page for
made a .desktop file and icon for it, copied the three files over
with scp -- and everything worked great.
There's no standard way yet to make a MeeGo RPM from a Python program,
so that will require a little hand-fiddling, but only a little.
And sadly, python-webkit-gtk isn't included,
so this isn't a good solution for porting web apps.
I'll be keeping an eye on PySide and continuing to experiment
with PySide, WRT and C++.
But in the meantime, it's great that it's so easy to port all
my existing Python-GTK programs to MeeGo.
[ 11:33 May 07, 2011
More programming |
permalink to this entry |