I develop cross-platform application for Maemo/Meego/Linux platforms using python (PySide). I use a workaround to distinguish between Maemo and Linux platfroms:
try:
import PySide.QtMaemo5
PLATFORM = 'maemo'
except ImportError:
PLATFORM = 'desktop'
Does anyone know how to detect Meego platform or a better way to detect Maemo platfrom?
Fist way: using platform module, for Maemo:
>>> import platform
>>> platform.machine()
'armv71'
>>> platform.node() ## This is Host Name, not a safe method
'Nokia N900'
Since platform is not helpfull at least for Maemo, I recommend the second (and safer) way: using /etc/issue:
issue = open('/etc/issue').read().strip().lower()
if issue.startswith('maemo'):
....
There has long been discussion on how to identify which particular distro your software is running on without a very satisfying answer. There are many hacks to do this but what might be most useful is to use the Linux Standards Base tool called "lsb_release".
It is included in MeeGo and you can use it like this;
$ lsb_release -a
Which produces;
LSB Version: :core-3.1-arm:core-3.1-noarch:core-3.2-arm:core-3.2-noarch:core-4.0-arm:core-4.0-noarch:desktop-3.1-arm:desktop-3.1-noarch:desktop-3.2-arm:desktop-3.2-noarch:desktop-4.0-arm:desktop-4.0-noarch Distributor ID: MeeGo Description: MeeGo release 1.1.90 (MeeGo) Release: 1.1.90 Codename: MeeGo
On my image. If you just want the release you can do 'lsb_release -r'.
Unfortunately, Maemo does not pay attention to the Linux Standards Base, see this bug: https://bugs.maemo.org/show_bug.cgi?id=10756 So you'll likely have to use /usr/bin/osso-product-info on Maemo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With