Python Framework for Symbian Series 60 phones

Wednesday 29 August 2007

Selfsigned and unsigned capabilities

Capabilities for self-signed certificate

NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment

Capabilities for unsigned certificates

NetworkServices LocalServices ReadUserData WriteUserData Location UserEnvironment PowerMgmt 
ProtServ SwEvent SurroundingsDD ReadDeviceData WriteDeviceData TrustedUI

Sunday 8 April 2007

Compile PyS60 script to bytecode

Follow the previous post instructions if you don't have Python 2.2.2 installed on your system.

import py_compile
 
py_compile.compile("mymodule.py")

Compile your PyS60 library to bytecode

First of all you need to install python 2.2.2 on your machine. It can be downloaded at http://www.python.org/download/releases/2.2.2/

I kept the installation folder by default (C:\>Python22) in order not to interfere with my current Python 2.5 installation (installed in C:\>Python).

Then

  • go to C:\Python22>
  • type python and you should have the following output:
Python 2.2.2 (#37, Oct 14 2002, 17:02:34) \[MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

All you have left to do is:

import compileall
 
compileall.compile_dir("myLibDirectory", force=1)

Thursday 14 December 2006

Install sysinfo on windows

I'll explain quickly how to make sisinfo as a proper command for you Windows OS accessible from anywhere in the file system. What's the advantage? You don't need to always go to the folder where sisinfo.py is stored and type

...\>python sisinfo.py ...



So first step is to download the package at http://www.niksula.cs.hut.fi/~jpsukane/sisinfo.html made by Jari Sukanen. (You need py2exe installed on your machine)

Unzip it. In my case it is situated at C:\Documents and Settings\xxx\Desktop\sisinfo. Open this folder in a command prompt:

Start > Run > cmd > cd Desktop\sisinfo

You can use Clickie also. If you don't know it it allows you to open a folder in MS-DOS Prompt from the right click context menu.

Now we make an executable of sisinfo:

\sisinfo>python setup.py py2exe

2 directories are created: dist and build. Copy dist and paste it where you want. I chose C:\Nokia\Tools\ . Then rename it sisinfo. You finally got C:\Nokia\Tools\sisinfo directory.

We now add its path to the system environment variables. So right click on My Computer > Advanced > Environment Variables.

We create a new key:

  • System Variables > New
  • Variable name = SISINFO_HOME
  • Variable value = C:\Nokia\Tools\sisinfo

Now we only need to add the new key to the path variable by adding %SISINFO_HOME%; (Edit) at the beginning or where you want in fact :)

A quick test: open a new command prompt (already opened prompt won't have sisinfo path cached) and type:

c:\>sysinfo

Then you should get:

ERROR : Filename must be defined
 
Usage: sisinfo [options]
 
Options:
  -f FILENAME, --file=FILENAME
                        Name of the SIS file to inspect
  -i, --info            Print information about SIS contents
  -s, --structure       Print SIS file structure
  -e PATH, --extract=PATH
                        Extract the files from the SIS file to PATH
  -c, --certificate     Print certificate information
  --version             show program's version number and exit
  -h, --help            show this help message and exit 

Voila

Saturday 7 October 2006

c++ extensions to pys60 3rd ed platform

Example code:

There are two interesting files on the example package. The rest of the files are just stuff for building and installing:

Download the full project definition.


Building for phone:

The C++ SDK shipped with GCCE compiler that is used to build the extensions. To build, simply do following:

bldmake bldfiles
abld build gcce urel

This will build the binary to <SDK path>\epoc32\release\gcce\urel\_uikludges.pyd.


Making installation package

Next we need to make installation package that is used to distribute the files to phone. Take a look at uikludges.pkg. This file defines the files to be installed. Run following commands to build the installation file:

mkdir _build
copy <SDK path>\epoc32\release\gcce\urel\_uikludges.pyd _build\
makesis uikludges.pkg

This will create uikludges.sis file.


Signing the package

Before we can send the installation package to phone, we need to sign it. In this example, we use self-signing. You can read more about signing from http://symbiansigned.com and http://forum.nokia.com.

In order to use self-signing, we need to generate certificate and private key:

makekeys -cert -password yourpassword -len 2048 -dname "CN=uikludges OU=Development" mykey.key mycert.cer

Then press keyboard to generate randomness.

Next, we use these keys to sign the package:

signsis uikludges.sis uikludges.sisx mycert.cer mykey.key yourpassword

Note that the .pkg uses UID which is used to identify the installation package. You can get your own UIDs by logging to http://symbiansigned.com and ordering UIDs. Order them from un-protected range if you plan to use self-signing. Please don't reuse the UIDs, otherwise there will be conflict, and that case the conflicting package cannot be installed.

Verifying installation package

After that you should have file uikludges.sisx which can be installed on the phone. Use Bluetooth or Nokia PC Suite to install it. You can verify that it works by typing this to interactive interpreter:

>>> import uikludges 
>>> uikludges.set_right_softkey_text(u"Back")



From: http://wiki.opensource.nokia.com/projects/PyS60_creating_extensions

LEFEVRE Damien
http://www.lfdm.net
contact@lfdm.net