|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 import sys, os, random |
|
18 |
|
19 output_dir = '' |
|
20 uid = None |
|
21 |
|
22 for i, item in enumerate(sys.argv): |
|
23 if item == '-output' and i + 1 < len(sys.argv): |
|
24 output_dir = sys.argv[i + 1] |
|
25 elif item == '-uid' and i + 1 < len(sys.argv): |
|
26 uid = sys.argv[i + 1] |
|
27 |
|
28 if uid is None: |
|
29 uid = "%016x" % random.getrandbits(64) |
|
30 else: |
|
31 if uid.lower().startswith('0x'): |
|
32 uid = uid[2:] |
|
33 |
|
34 #print "uid = %s" % uid |
|
35 |
|
36 |
|
37 def write_file(file_path, data): |
|
38 dir = os.path.dirname(file_path) |
|
39 if dir != '' and not os.path.exists(dir): |
|
40 os.makedirs(dir) |
|
41 |
|
42 f = open(file_path, "wb") |
|
43 try: f.write(data) |
|
44 finally: f.close() |
|
45 |
|
46 write_file(os.path.join(output_dir, 'themepackage.mbm'), 'xyz') |
|
47 write_file(os.path.join(output_dir, 'themepackage.mif'), 'zyx') |
|
48 write_file(os.path.join(output_dir, 'themepackage.skn'), 'foo') |
|
49 |
|
50 pkg_data = r""" |
|
51 IF PACKAGE(0X102032BE) ; CHECK FOR S60 3.1 STUB SIS |
|
52 "themepackage.mbm" - "!:\resource\skins\%(uid)s\themepackage.mbm" |
|
53 "themepackage.mif" - "!:\resource\skins\%(uid)s\themepackage.mif" |
|
54 ELSE |
|
55 "themepackage.mbm" - "!:\private\10207114\import\%(uid)s\themepackage.mbm" |
|
56 "themepackage.mif" - "!:\private\10207114\import\%(uid)s\themepackage.mif" |
|
57 ENDIF |
|
58 "themepackage.skn" - "!:\private\10207114\import\%(uid)s\themepackage.skn" |
|
59 ;Dummy entry for the possible skin .ini file,so that it gets removed on uninstall |
|
60 "" - "!:\private\10207114\import\%(uid)s\%(uid)s.ini",FN |
|
61 """ % {'uid': uid} |
|
62 |
|
63 write_file(os.path.join(output_dir, 'themepackage.pkg'), pkg_data) |