Python For S60 3rd Edition
Python For S60 3rd Edition
Version 1.0
Oct. 5th, 2007
Introduction to the Python for S60 on S60 3rd Edition 2
Introduction
This document includes the information required by developers to create applications
that use Python for S60, and some advice on extending the platform.
The new platform security features in S60 3rd Edition require several changes to the
whole Python for S60 framework. Without these modifications, S60 3rd Edition can‘t be
supported by Python for S60.
In this article, stand-alone installation will be walked through. In essence, this makes
Python applications no difference from any native Symbian applications ─ a user cannot
tell whether this is a Python or Symbian C++ application. The installed Python
application icon is visible in the device main menu. In addition, a script shell, which can
be found in the installed “Python” application, may also enable a user to run individual
Python scripts.
Note: This document introduces Python for S60 on S60 3rd Edition. The advices
described here are not applicable to Python for S60 running on S60 1st or 2nd Edition,
and the developers on these platforms are not affected in any way.
Since a standalone Python for S60 application is not different from a native application--
and runs in a separate process, which means it needs to be signed if it uses some
sensitive APIs.
Because the Python application is seen from the device’s main menu, the script shell,
which is also a Python application, needs to be signed. The script shell should not
enable users to run scripts with big capability set, and thus, it is not signed by Nokia with
the same capabilities as the interpreter DLL. This should not cause problems-- you can
sign the script shell application with a developer certificate, which can be applied from
www.symbiansigned.com. Since there are two separate signing needs for the Python
interpreter DLL and the script shell application, there are two separate packages ('X'
indicates version number):
Keep in mind that the script shell is just a normal application, similar to the one you wrap
with “py2sis” (a tool to package Python scripts to SIS package) and subject to the all
the same security preconditions described earlier. The interpreter DLL is used by all the
standalone Python applications, and is the entity a developer needs to sign with as many
capabilities as the developer can get (for some capabilities, developers needs to justify
their business reasons to get approval from Nokia as shown in the signing section). In
this case, the developer can ensure that individual Python applications can access the
controlled resources as freely as possible. The maximum capability set of a Python
application should not be beyond the capability set assigned to the interpreter DLL due
to platform security reason.
Click here
(https://www.symbiansigned.com/How_has_Symbian_Signed_evolved_with_Symbian_O
S_v9.pdf) for an overview of the Symbian signed process and platform security.
• Step 1: Install a working version of the S60 3rd Edition C++ SDK at
www.forum.nokia.com for free.
• Step 2: Install a working version of Python, tested with Python 2.4.4 (see
http://www.python.org/download/releases/2.4.4/).
• Step 3: Download standard Python for S60 source distribution. It comes with
“py2sis” (tested with pys60-1_4_1_src) tool that can be used to create standalone
applications from your Python scripts. The packaged Python applications are not
different from native applications to a devices end user. For obtaining pys60-
1.4.1.src, see: http://sourceforge.net/project/showfiles.php?group_id=154155.
Unpack the downloaded package to a folder in PC hard disk. For example, the
package can be unzipped to the folder “C:\Symbian\9.1\S60_3rd_MR\pys60-
1_3_15_src”
• Step 5: py2sis also currently requires that the SDK configuration is subst'ed. This
means that e.g.:
C:\>subst V: C:\Symbian\9.1\S60_3rd_MR
• Step 6: Invoke the following code ("ball.py" is the script you are packaging):
V:\pys60-1_3_15_src\src\py2sis>C:\Python24\python py2sis.py
ball.py --uid=0x01234567 --sdk30 --caps="NetworkServices
LocalServices ReadUserData WriteUserData" –leavetemp
where “yourcert.cer” and “yourkey.key” are the certificate and key used for
signing the application. After issuing the above command, an output file “ball.sisx”
(normally, the signed “.sis” file has the extension name “.sisx” although it does not
really matter) file will be generated at the current directory, and it has been signed
with your own certificate. “ball.sisx” is actually an installable file for the target
devices. A developer may use Bluetooth/Infra-red/Memory card to deploy it onto a
real device.
The following section will further detail how to sign and deploy a Python application
onto a S60 3rd Edition device.
To execute the scripts on an S60 3rd Edition target device, developers need to sign their
applications before installing them into a real device since the platform security
restrictions are implemented in the target devices.
Symbian signed recently made some big changes to the Symbian signed policy, and the
changes greatly affect the Symbian signed process and application deployment. The
detailed information can be found at: http://developer.symbian.com/main/signed/.
Hereafter is the figure for the new Symbian signed policy:
LocalServices
For testing
User
version
& sales
ReadUserData
WriteUserData
Sales version
NetworkServices
For testing
UserEnvironment
Sales version
Location
SwEvent System 1
Sales version
ProtServ
TrustedUI
PowerMgmt
SurroundingsDD
ReadDeviceData
WriteDeviceData
CommDD
System 2
DiskAdmin
MultimediaDD
NetworkControl
AllFiles Device
DRM Manufacturer Manufactur
TCB er
From the figure, the Symbian capability has been categorized into four groups:
Depending on capabilities used, there are a few ways for signing a Python application:
4) Express signed: A developer must have a publisher ID first. The developer has
to go to www.symbiansigned.com website to login, and upload the needed files
to the website. Immediately, a developer can get the application signed by the
website, and the developer may download it from the website. The signed
application is for commercial sales.
6) Symbian signed for Nokia: Any of the applications needed for pre-installation
must pass Nokia test criteria. It has stricter criteria than “Certified signed”. The
detailed information can be found at: www.symbiansigned.com. This is for
commercial use.
The py2sis program allows you to package individual scripts to installable SISX
packages. The packages generated by py2sis require you to install the 'PythonForS60-
X_X_X_3rdEd.SIS' in a real device.
The Python functions or modules affected by platform security are outlined below in
Table 1:
location.gsm_location()* ReadUserData
ReadDeviceData
Location
images WriteUserData
sounds ReadDeviceData
WriteDeviceData
Sysinfo.imei() ReadDeviceData+ OK
* = This gives false data if the executable is not signed with the specific capabilities.
If the following extensions are used, no capabilities are needed. Self-signing is sufficient:
• camera
• e32db
• inbox
• audio
• socket
• graphics
As described above, S60 3rd Edition has introduced platform security feature in platform.
The change has some big impacts on the way how a developer develops an application
and how an application gets tested and deployed. Now, for S60 3rd Edition, the script
shell application has been separated to a new SISX file from the main Python interpreter
distribution. These two SISX files could be signed separately with different set of
capabilities. With Python for S60 in place on S60 3 rd Edition platform, a developer may
use Python script language to fast develop mobile applications.
More Resources
1. Python website, http://www.python.org