0
|
1 |
# Copyright (c) 2008-2009 Nokia Corporation
|
|
2 |
#
|
|
3 |
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
# you may not use this file except in compliance with the License.
|
|
5 |
# You may obtain a copy of the License at
|
|
6 |
#
|
|
7 |
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
#
|
|
9 |
# Unless required by applicable law or agreed to in writing, software
|
|
10 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
# See the License for the specific language governing permissions and
|
|
13 |
# limitations under the License.
|
|
14 |
#
|
|
15 |
|
|
16 |
import os
|
|
17 |
import sys
|
|
18 |
import os.path
|
|
19 |
import shutil
|
|
20 |
import time
|
|
21 |
import re
|
|
22 |
from optparse import OptionParser
|
|
23 |
sys.path.append(os.path.join(os.getcwd(), 'tools'))
|
|
24 |
import code_size
|
|
25 |
from shellutil import *
|
|
26 |
import build_utils
|
|
27 |
|
|
28 |
|
|
29 |
topdir = os.getcwd()
|
|
30 |
|
|
31 |
# Variables needed to create the package
|
|
32 |
installshield_dir = "c:\\Program Files\\InstallShield\\2009\\System"
|
|
33 |
installer_dir = topdir + '\\tools\\installer\\'
|
|
34 |
#.ism file is the project file for InstallShield
|
|
35 |
ism_path = installer_dir + "PythonForS60.ism"
|
|
36 |
release_name = "Beta"
|
|
37 |
project_configuration = "PythonForS60"
|
|
38 |
|
|
39 |
|
|
40 |
PROJ_DIR = "..\\build_dep"
|
|
41 |
|
|
42 |
# SDK install paths used by junction tool to swap SDK epoc32 folders
|
|
43 |
epoc_3_0 = 'C:\\Symbian\\9.1\\S60_3rd_MR\\epoc32'
|
|
44 |
epoc_3_1 = 'C:\\Symbian\\9.1\\S60_3_1\\epoc32'
|
|
45 |
epoc_3_2 = 'C:\\Symbian\\9.1\\S60_3rd_FP2_SDK\\epoc32'
|
|
46 |
epoc_5_0 = 'C:\\Symbian\\9.4\\S60_5th_Edition_SDK_v1.0\\epoc32'
|
|
47 |
|
|
48 |
# Please update this dictionary with all the informations required
|
|
49 |
# to configure the source for a particular flavor
|
|
50 |
variants = {'unsigned_devcert': {
|
|
51 |
'capas': 'LocalServices NetworkServices ReadUserData' +
|
|
52 |
' WriteUserData UserEnvironment Location' +
|
|
53 |
' PowerMgmt ProtServ SwEvent SurroundingsDD' +
|
|
54 |
' ReadDeviceData WriteDeviceData TrustedUI'},
|
|
55 |
'unsigned_alabs': {
|
|
56 |
'capas': '''ALL -TCB -DRM -AllFiles''',
|
|
57 |
'exe_capas': 'LocalServices NetworkServices' +
|
|
58 |
' ReadUserData WriteUserData' +
|
|
59 |
' UserEnvironment'},
|
|
60 |
'alabs_pythonteam': {
|
|
61 |
'capas': '''ALL -TCB -DRM -AllFiles''',
|
|
62 |
'key': 'pythonteam'},
|
|
63 |
'selfsigned': {
|
|
64 |
'capas': 'LocalServices NetworkServices' +
|
|
65 |
' ReadUserData WriteUserData' +
|
|
66 |
' UserEnvironment',
|
|
67 |
'key': "selfsigned"},
|
|
68 |
'unsigned_3_0': {
|
|
69 |
'capas': 'LocalServices NetworkServices' +
|
|
70 |
' ReadUserData WriteUserData' +
|
|
71 |
' UserEnvironment',
|
|
72 |
'uid': '0x20022EED'},
|
|
73 |
'unsigned_3_2': {
|
|
74 |
'capas': 'LocalServices NetworkServices' +
|
|
75 |
' ReadUserData WriteUserData' +
|
|
76 |
' UserEnvironment Location',
|
|
77 |
'uid': '0x20022EEC'},
|
|
78 |
'white_choco': {
|
|
79 |
'capas': '''ALL -TCB''',
|
|
80 |
'key': "pythonteam"},
|
|
81 |
'dark_choco': {
|
|
82 |
'capas': '''ALL -TCB''',
|
|
83 |
'key': "rd02"},
|
|
84 |
'unsigned_high_capas': {
|
|
85 |
'capas': 'LocalServices NetworkServices ReadUserData' +
|
|
86 |
' WriteUserData UserEnvironment Location' +
|
|
87 |
' WriteDeviceData ReadDeviceData SwEvent',
|
|
88 |
'uid': '0x20022EE9'},
|
|
89 |
'high_capas_pythonteam': {
|
|
90 |
'capas': 'LocalServices NetworkServices ReadUserData' +
|
|
91 |
' WriteUserData UserEnvironment Location' +
|
|
92 |
' WriteDeviceData ReadDeviceData SwEvent',
|
|
93 |
'key': 'pythonteam',
|
|
94 |
'uid': '0x20022EE9'}}
|
|
95 |
|
|
96 |
# Update the below dictionary to change the deliverables name
|
|
97 |
deliverables_name = {
|
|
98 |
'30armv5': {'python_dll_sis_name': ['Python25_3rdEd.SIS',
|
|
99 |
'Python_%s%s_3rdEd_%s.sis',
|
|
100 |
'\\newcore\\symbian\\group'],
|
|
101 |
'testapp_sis_name': ['testapp_3rdEd.SIS',
|
|
102 |
'testapp_%s%s_3rdEd_%s.sis',
|
|
103 |
'\\ext\\test\\testapp\\group', 'test'],
|
|
104 |
'sdk_zip_name': ['Python_SDK_3rdEd.zip',
|
|
105 |
'Python_%s%s_SDK_3rdEd.zip'],
|
|
106 |
'run_testapp_sis_name': ['run_testapp_3rdEd.SIS',
|
|
107 |
'run_testapp_%s%s_3rdEd_%s.sis',
|
|
108 |
'\\ext\\test\\run_testapp\\group',
|
|
109 |
'test'],
|
|
110 |
'run-interpretertimer_sis_name':
|
|
111 |
['run-interpretertimer_3rdEd.SIS',
|
|
112 |
'run-interpretertimer_%s%s_3rdEd_%s.sis',
|
|
113 |
'\\ext\\test\\run-interpretertimer\\group',
|
|
114 |
'test'],
|
|
115 |
'interpreter-startup_sis_name':
|
|
116 |
['interpreter-startup_3rdEd.SIS',
|
|
117 |
'interpreter-startup_%s%s_3rdEd_%s.sis',
|
|
118 |
'\\ext\\test\\interpreter-startup\\group',
|
|
119 |
'test']},
|
|
120 |
'50armv5': {'python_dll_sis_name': ['Python25_5thEd.SIS',
|
|
121 |
'Python_%s%s_5thEd_%s.sis',
|
|
122 |
'\\newcore\\symbian\\group'],
|
|
123 |
'testapp_sis_name': ['testapp_5thEd.SIS',
|
|
124 |
'testapp_%s%s_5thEd_%s.sis',
|
|
125 |
'\\ext\\test\\testapp\\group',
|
|
126 |
'test'],
|
|
127 |
'run_testapp_sis_name': ['run_testapp_5thEd.SIS',
|
|
128 |
'run_testapp_%s%s_5thEd_%s.sis',
|
|
129 |
'\\ext\\test\\run_testapp\\group',
|
|
130 |
'test'],
|
|
131 |
'run-interpretertimer_sis_name':
|
|
132 |
['run-interpretertimer_5thEd.SIS',
|
|
133 |
'run-interpretertimer_%s%s_5thEd_%s.sis',
|
|
134 |
'\\ext\\test\\run-interpretertimer\\group',
|
|
135 |
'test'],
|
|
136 |
'interpreter-startup_sis_name':
|
|
137 |
['interpreter-startup_5thEd.SIS',
|
|
138 |
'interpreter-startup_%s%s_5thEd_%s.sis',
|
|
139 |
'\\ext\\test\\interpreter-startup\\group',
|
|
140 |
'test'],
|
|
141 |
'sdk_zip_name': ['Python_SDK_5thEd.zip',
|
|
142 |
'Python_%s%s_SDK_5thEd.zip']},
|
|
143 |
'31': {'sdk_zip_name': ['Python_SDK_3rdEd.zip',
|
|
144 |
'Python_%s%s_SDK_3rdEdFP1.zip']},
|
|
145 |
'32': {'python_dll_sis_name': ['Python25_3rdEdFP2.SIS',
|
|
146 |
'Python_%s%s_3rdEd_%s.sis',
|
|
147 |
'\\newcore\\symbian\\group'],
|
|
148 |
'testapp_sis_name': ['testapp_3rdEdFP2.SIS',
|
|
149 |
'testapp_%s%s_3rdEd_%s.sis',
|
|
150 |
'\\ext\\test\\testapp\\group', 'test'],
|
|
151 |
'sdk_zip_name': ['Python_SDK_3rdEdFP2.zip',
|
|
152 |
'Python_%s%s_SDK_3rdEdFP2.zip'],
|
|
153 |
'run_testapp_sis_name': ['run_testapp_3rdEdFP2.SIS',
|
|
154 |
'run_testapp_%s%s_3rdEd_%s.sis',
|
|
155 |
'\\ext\\test\\run_testapp\\group',
|
|
156 |
'test'],
|
|
157 |
'run-interpretertimer_sis_name':
|
|
158 |
['run-interpretertimer_3rdEdFP2.SIS',
|
|
159 |
'run-interpretertimer_%s%s_3rdEd_%s.sis',
|
|
160 |
'\\ext\\test\\run-interpretertimer\\group',
|
|
161 |
'test'],
|
|
162 |
'interpreter-startup_sis_name':
|
|
163 |
['interpreter-startup_3rdEdFP2.SIS',
|
|
164 |
'interpreter-startup_%s%s_3rdEd_%s.sis',
|
|
165 |
'\\ext\\test\\interpreter-startup\\group',
|
|
166 |
'test']}}
|
|
167 |
# TO-Do
|
|
168 |
# Generic method to log the PyS60 build errors
|
|
169 |
|
|
170 |
|
|
171 |
def generic_errors(args, __func__):
|
|
172 |
try:
|
|
173 |
__func__(path)
|
|
174 |
except OSError, (errno, strerror):
|
|
175 |
print ERROR_STR % {'*** Error': strerror}
|
|
176 |
|
|
177 |
|
|
178 |
def create_readybuild_dirs():
|
|
179 |
# Method that create a clean directory to store the deliverables
|
|
180 |
# --work-area option can be used in command to change the deliverable path
|
|
181 |
# Ex- builder.py --work-area c:\\temp\\readybuild
|
|
182 |
dir_path = os.path.abspath(python_readybuild_dir)
|
|
183 |
deltree_if_exists(dir_path)
|
|
184 |
os.makedirs(dir_path + '\\test')
|
|
185 |
|
|
186 |
|
|
187 |
def move_deliverable_to_readybuild_dir(platform, flavor):
|
|
188 |
# Method that renames all the deliverables to PyS60 standard and moves to
|
|
189 |
# deliverable directory
|
|
190 |
platform_name = deliverables_name[platform]
|
|
191 |
for deliverable in platform_name.keys():
|
|
192 |
if deliverable == 'sdk_zip_name':
|
|
193 |
continue
|
|
194 |
sis_name = platform_name[deliverable][0]
|
|
195 |
final_sis_name = platform_name[deliverable][1] \
|
|
196 |
%(version, version_tag, flavor)
|
|
197 |
os.chdir(topdir + platform_name[deliverable][2])
|
|
198 |
if os.path.exists(sis_name):
|
|
199 |
rename_file(sis_name, final_sis_name)
|
|
200 |
else:
|
|
201 |
continue
|
|
202 |
if 'test' in platform_name[deliverable]:
|
|
203 |
output_dir = python_readybuild_dir + '\\test'
|
|
204 |
else:
|
|
205 |
output_dir = python_readybuild_dir
|
|
206 |
shutil.move(final_sis_name,
|
|
207 |
'%s\\%s' % (output_dir, final_sis_name))
|
|
208 |
os.chdir(topdir)
|
|
209 |
|
|
210 |
|
|
211 |
def do_clean_and_build_emu(flavor, platforms, run_regrtest=True):
|
|
212 |
# Method that compiles source for emulator environment
|
|
213 |
# for given list of flavors
|
|
214 |
global setup_configure
|
|
215 |
for platform in platforms:
|
|
216 |
run_cmd('python setup.py clean', exception_on_error=0)
|
|
217 |
do_setupdotpy_configure(flavor, platform)
|
|
218 |
run_cmd('python setup.py build --emu')
|
|
219 |
|
|
220 |
if run_regrtest:
|
|
221 |
run_cmd('python setup.py test --testset-size 350')
|
|
222 |
|
|
223 |
|
|
224 |
def create_and_move_device_deliverables(platform, flavor):
|
|
225 |
# Method that compiles source for device environment for
|
|
226 |
# given list of flavors and moves the sis files to work area directory
|
|
227 |
if not 'key' in variants[flavor]:
|
|
228 |
run_cmd('python setup.py bdist_sis')
|
|
229 |
else:
|
|
230 |
run_cmd('python setup.py bdist_sis --keydir %s --key %s' \
|
|
231 |
% (key_dir, '%(key)s' % variants[flavor]))
|
|
232 |
if flavor == 'unsigned_alabs':
|
|
233 |
cert = os.path.join(topdir, key_dir, 'pythonteam.crt')
|
|
234 |
key = os.path.join(topdir, key_dir, 'pythonteam.key')
|
|
235 |
passphrase = ''
|
|
236 |
os.chdir(topdir +
|
|
237 |
deliverables_name[platform]['python_dll_sis_name'][2])
|
|
238 |
final_name = deliverables_name[platform]['python_dll_sis_name'][1] %\
|
|
239 |
(version, version_tag, 'alabs_pythonteam')
|
|
240 |
run_cmd('signsis ' +
|
|
241 |
deliverables_name[platform]['python_dll_sis_name'][0] + ' ' +
|
|
242 |
final_name + ' %s %s %s' %
|
|
243 |
(cert, key, passphrase))
|
|
244 |
shutil.move(final_name,
|
|
245 |
'%s\\%s' % (python_readybuild_dir, final_name))
|
|
246 |
os.chdir(topdir)
|
|
247 |
move_deliverable_to_readybuild_dir(platform, flavor)
|
|
248 |
|
|
249 |
|
|
250 |
def do_setupdotpy_configure(flavor, platform):
|
|
251 |
# Method that calls setup.py configure with arguments based on arguments
|
|
252 |
# passed to builder.py
|
|
253 |
global setup_configure
|
|
254 |
setup_configure = "python setup.py configure --sdk %s --version %s \
|
|
255 |
--version-tag %s --build-profile %s" \
|
|
256 |
% (platform, version, version_tag, build_profile)
|
|
257 |
if include_internal_src:
|
|
258 |
setup_configure += " --include-internal-src"
|
|
259 |
setup_configure += " --compression-type=" + compression_type
|
|
260 |
if profiler:
|
|
261 |
setup_configure += " --profile_log "
|
|
262 |
if compiler_flags:
|
|
263 |
setup_configure += ' --compiler-flags "' + compiler_flags + '"'
|
|
264 |
if not 'key' in variants[flavor]:
|
|
265 |
setup_configure += ' --caps="' + variants[flavor]['capas'] + '"'
|
|
266 |
if 'exe_capas' in variants[flavor]:
|
|
267 |
setup_configure += " --exe-caps " + variants[flavor]['exe_capas']
|
|
268 |
else:
|
|
269 |
setup_configure += " --keydir " + key_dir + " --key " \
|
|
270 |
+ variants[flavor]['key']
|
|
271 |
if internal_proj:
|
|
272 |
# Add the internal projects to the build
|
|
273 |
setup_configure += " --internal-projects"
|
|
274 |
run_cmd(setup_configure)
|
|
275 |
log('''builder.py - Building platform: %s and flavor: %s''' %
|
|
276 |
(platform, flavor))
|
|
277 |
|
|
278 |
|
|
279 |
def create_deliverables_using_elftran(platform, flavors, create_sis):
|
|
280 |
# Creates the different flavors of PyS60, using postlinker tool ELFTRAN
|
|
281 |
for flavor in flavors:
|
|
282 |
log('builder.py - Using ELFTRAN to generate flavor: %s' % flavor)
|
|
283 |
cmd = 'python setup.py setcaps -c "%(capas)s"' % variants[flavor]
|
|
284 |
if 'exe_capas' in variants[flavor]:
|
|
285 |
cmd += ' --exe-caps "' + variants[flavor]['exe_capas'] + '"'
|
|
286 |
run_cmd(cmd)
|
|
287 |
if create_sis:
|
|
288 |
create_and_move_device_deliverables(platform, flavor)
|
|
289 |
|
|
290 |
|
|
291 |
def build_device_and_move_sis(flavors, platforms, create_sis=True):
|
|
292 |
# Builds the source for device(unsigned_high_capas variant) and creates
|
|
293 |
# the flavors specified using elftran
|
|
294 |
for platform in platforms:
|
|
295 |
do_setupdotpy_configure('unsigned_high_capas', platform)
|
|
296 |
run_cmd('python setup.py build --device')
|
|
297 |
create_deliverables_using_elftran(platform, flavors, create_sis)
|
|
298 |
|
|
299 |
|
|
300 |
def create_and_move_zip(platforms):
|
|
301 |
global create_temp_sdk_zip
|
|
302 |
|
|
303 |
def create_sdk_zip(platforms, armv5_pyds=False):
|
|
304 |
# Creates the sdk zip and moves it to work area directory
|
|
305 |
pyds_opt = ""
|
|
306 |
final_sdk_zip_name = ""
|
|
307 |
if armv5_pyds:
|
|
308 |
pyds_opt = " --create-temp-sdk-zip"
|
|
309 |
final_sdk_zip_name = 'Python_SDK_3rdEd_temp.zip'
|
|
310 |
else:
|
|
311 |
final_sdk_zip_name = deliverables_name[platforms]['sdk_zip_name'][1]\
|
|
312 |
% (version, version_tag)
|
|
313 |
|
|
314 |
run_cmd('python setup.py bdist_sdk' + pyds_opt)
|
|
315 |
sdk_zip_name = deliverables_name[platforms]['sdk_zip_name'][0]
|
|
316 |
rename_file(sdk_zip_name, final_sdk_zip_name)
|
|
317 |
shutil.move(final_sdk_zip_name,
|
|
318 |
'%s\\%s' % (python_readybuild_dir, final_sdk_zip_name))
|
|
319 |
|
|
320 |
if create_temp_sdk_zip and platforms == '30armv5':
|
|
321 |
create_sdk_zip(platforms)
|
|
322 |
create_sdk_zip(platforms, True)
|
|
323 |
else:
|
|
324 |
create_sdk_zip(platforms)
|
|
325 |
|
|
326 |
def init_args(params):
|
|
327 |
# Parse all the arguments using optparse module
|
|
328 |
global platforms
|
|
329 |
global target
|
|
330 |
global version
|
|
331 |
global version_tag
|
|
332 |
global platforms
|
|
333 |
global python_readybuild_dir
|
|
334 |
global key_dir
|
|
335 |
global gflavors
|
|
336 |
global generate_docs
|
|
337 |
global grelease
|
|
338 |
global profiler
|
|
339 |
global compiler_flags
|
|
340 |
global integration_bld
|
|
341 |
global compression_type
|
|
342 |
global internal_proj
|
|
343 |
global without_src_zip
|
|
344 |
global without_ensymble
|
|
345 |
global installer
|
|
346 |
global include_internal_src
|
|
347 |
global build_profile
|
|
348 |
global create_temp_sdk_zip
|
|
349 |
|
|
350 |
# Set default build profile to 'integration'
|
|
351 |
build_profile = 'integration'
|
|
352 |
|
|
353 |
parser = OptionParser()
|
|
354 |
default_version_tag = 'svn' + get_svn_revision()
|
|
355 |
parser.add_option("-p", "--profile_log", dest="profiler",
|
|
356 |
action="store_true", default=False,
|
|
357 |
help="Profile log generator" +
|
|
358 |
"for python[default: %default]")
|
|
359 |
parser.add_option("-v", "--version", dest="version", default='2.0.0',
|
|
360 |
help="Python release version [default: %default]")
|
|
361 |
parser.add_option("-r", "--version-tag", dest="version_tag",
|
|
362 |
default=default_version_tag,
|
|
363 |
help="Release tag [default: %default]")
|
|
364 |
parser.add_option("--compiler-flags", dest="compiler_flags",
|
|
365 |
default='',
|
|
366 |
help="Compiler flags to be used while building the" +
|
|
367 |
" python interpreter core [default: %default]")
|
|
368 |
parser.add_option("-t", "--targets", dest="targets", default='all',
|
|
369 |
help="Build target emu/device [default: %default]")
|
|
370 |
parser.add_option("-s", "--sdk", dest="platforms", default='50armv5',
|
|
371 |
help="Configure the source for a given SDK." +
|
|
372 |
"Options : %s"%', '.join(deliverables_name.keys())+
|
|
373 |
' [default: %default]')
|
|
374 |
parser.add_option("-f", "--flavors", dest="flavors",
|
|
375 |
help="Choose any set of flavors for build " +
|
|
376 |
"%s [default: all the flavors]" \
|
|
377 |
% ','.join(variants.keys()))
|
|
378 |
parser.add_option("--work-area", dest="work_area", default='build',
|
|
379 |
help="Path for deliverables [default: %default]")
|
|
380 |
parser.add_option("--keydir", dest="key", default='..\\keys',
|
|
381 |
help="Key path")
|
|
382 |
parser.add_option("-d", "--docs", action="store_true", dest="doc",
|
|
383 |
default=False,
|
|
384 |
help="Compiles the documentation and moves the html" +
|
|
385 |
"files to work_area\docs [default: %default]" +
|
|
386 |
"Read README.txt for more information.")
|
|
387 |
parser.add_option("--include-internal-src", action = 'store_true',
|
|
388 |
dest = "include_internal_src", default = False,
|
|
389 |
help = "Include the source under ..\internal-src for" +
|
|
390 |
" build. [default: %default]")
|
|
391 |
parser.add_option("--integration-build", action="store_true",
|
|
392 |
dest="integ_bld", default=False,
|
|
393 |
help="Does an integration build. This also sets the" +
|
|
394 |
" --include-internal-src option. " +
|
|
395 |
"[default: %default]")
|
|
396 |
parser.add_option("--internal-projects", action="store_true",
|
|
397 |
dest="internal_proj", default=False,
|
|
398 |
help="Builds internal projects like " +
|
|
399 |
"interpreter-startup, run_testapp " +
|
|
400 |
"etc... [default: %default]")
|
|
401 |
parser.add_option("--release-build", action="store_true",
|
|
402 |
dest="release", default=False,
|
|
403 |
help="Build all the deliverables required for " +
|
|
404 |
"releasing 1.9.x. This also sets the" +
|
|
405 |
" --include-internal-src option. " +
|
|
406 |
"[default: %default]")
|
|
407 |
parser.add_option("--compression-type", dest="compression_type",
|
|
408 |
default='',
|
|
409 |
help="Modify the compression type of all the " +
|
|
410 |
"E32Image files generated, using 'elftran " +
|
|
411 |
"-compressionmethod'. Refer elftran help for valid " +
|
|
412 |
"compression types. If the type is given as '', " +
|
|
413 |
"elftran is not invoked for modifying the " +
|
|
414 |
"compression type. [default: '']")
|
|
415 |
parser.add_option("--without-src-zip", action="store_true",
|
|
416 |
dest="without_src", default=False,
|
|
417 |
help="Does not create a source zip when doing a " +
|
|
418 |
"--release-build [default: %default]")
|
|
419 |
parser.add_option("--without-ensymble", action="store_true",
|
|
420 |
dest="without_ensymble", default=False,
|
|
421 |
help="Disables the ensymble build [default: %default]")
|
|
422 |
parser.add_option("--installer", action="store_true",
|
|
423 |
dest="installer", default=False,
|
|
424 |
help="Builds and creates a Setup.exe for PYS60 " +
|
|
425 |
"[default: %default]")
|
|
426 |
parser.add_option("--create-temp-sdk-zip", action="store_true",
|
|
427 |
dest="create_temp_sdk_zip", default=False,
|
|
428 |
help="Creates an sdkzip with all armv5 binaries" +
|
|
429 |
"[default: %default]")
|
|
430 |
|
|
431 |
(options, args) = parser.parse_args()
|
|
432 |
target = options.targets
|
|
433 |
version = options.version
|
|
434 |
version_tag = options.version_tag
|
|
435 |
|
|
436 |
platforms = options.platforms.split(',')
|
|
437 |
#python_readybuild_dir = options.work_area
|
|
438 |
python_readybuild_dir = topdir + '\\build'
|
|
439 |
key_dir = options.key
|
|
440 |
generate_docs = options.doc
|
|
441 |
grelease = options.release
|
|
442 |
if options.flavors:
|
|
443 |
gflavors = options.flavors.split(',')
|
|
444 |
else:
|
|
445 |
gflavors = variants.keys()
|
|
446 |
profiler = options.profiler
|
|
447 |
compiler_flags = options.compiler_flags
|
|
448 |
without_src_zip = options.without_src
|
|
449 |
integration_bld = options.integ_bld
|
|
450 |
internal_proj = options.internal_proj
|
|
451 |
without_ensymble = options.without_ensymble
|
|
452 |
installer = options.installer
|
|
453 |
compression_type = options.compression_type
|
|
454 |
create_temp_sdk_zip = options.create_temp_sdk_zip
|
|
455 |
|
|
456 |
include_internal_src = False
|
|
457 |
if options.include_internal_src:
|
|
458 |
include_internal_src = True
|
|
459 |
|
|
460 |
if integration_bld:
|
|
461 |
#platforms, gflavors, version_tag needs to be updated for this build
|
|
462 |
set_integration_env()
|
|
463 |
|
|
464 |
|
|
465 |
class RunBuildCmd(Thread):
|
|
466 |
|
|
467 |
def __init__(self, build_cmd):
|
|
468 |
Thread.__init__(self)
|
|
469 |
self.build_cmd = build_cmd
|
|
470 |
|
|
471 |
def run(self):
|
|
472 |
run_cmd('python setup.py ' + self.build_cmd)
|
|
473 |
|
|
474 |
|
|
475 |
class BuildInstaller(Thread):
|
|
476 |
|
|
477 |
def __init__(self):
|
|
478 |
Thread.__init__(self)
|
|
479 |
|
|
480 |
def run(self):
|
|
481 |
print "Building the Installer Package ..."
|
|
482 |
|
|
483 |
package_files = \
|
|
484 |
{'..\\tools\\py2sis\\ensymble\\':
|
|
485 |
['ensymble.py', 'templates', 'README',
|
|
486 |
'module-repo'],
|
|
487 |
'..\\tools\\py2sis\\ensymble_ui\\images\\':
|
|
488 |
['python_logo.gif'],
|
|
489 |
'..\\tools\\py2sis\\ensymble_ui\\':
|
|
490 |
['ensymble_gui.pyw', 'ensymble_ui_help.html'],
|
|
491 |
topdir + '\\tools\\installer\\doc\\':
|
|
492 |
['Quickguide.html', 'python_logo.PNG']}
|
|
493 |
|
|
494 |
package_dir = topdir + "\\build\\PythonForS60"
|
|
495 |
|
|
496 |
# Files which are present in the Windows Installer setup but which
|
|
497 |
# should not be present in the Linux/Mac package
|
|
498 |
files_not_in_pys60_archive = {topdir +
|
|
499 |
'\\build\\PythonForS60_package\\PythonForS60\\':
|
|
500 |
['Quickguide.html', 'ensymble_gui.pyw',
|
|
501 |
'ensymble_ui_help.html',
|
|
502 |
'python_logo.PNG']}
|
|
503 |
package_dependencies_dir = "C:\\Installer_Dependency\\PyS60Dependencies"
|
|
504 |
# These files are copied to the local directory pointed
|
|
505 |
# by `PyS60Dependencies` for packaging as dependency files.
|
|
506 |
package_dependencies = [
|
|
507 |
'Python_%s%s_3rdEd_alabs_pythonteam.sis' % (version, version_tag),
|
|
508 |
'Python_%s%s_3rdEd_unsigned_alabs.sis' % (version, version_tag),
|
|
509 |
'PythonScriptShell_%s_unsigned_3_0.sis' % version,
|
|
510 |
'PythonScriptShell_%s_unsigned_3_2.sis' % version,
|
|
511 |
'PythonScriptShell_%s_unsigned_high_capas.sis' % version,
|
|
512 |
'PythonScriptShell_%s_high_capas_pythonteam.sis' % version,
|
|
513 |
'PythonScriptShell_%s_unsigned_devcert.sis' % version]
|
|
514 |
|
|
515 |
if not os.path.exists(package_dir):
|
|
516 |
print "Creating the temporary PythonForS60 folder"
|
|
517 |
os.mkdir(package_dir)
|
|
518 |
|
|
519 |
# Copy all the files that will be part of either Installer or the zip
|
|
520 |
# package to the PythonForS60 folder under 'src\Build'
|
|
521 |
print "Copying the files to PythonForS60 to be picked by Installer"
|
|
522 |
current_dir = os.getcwd()
|
|
523 |
os.chdir(topdir + '\\build')
|
|
524 |
for path in package_files:
|
|
525 |
for entry in package_files[path]:
|
|
526 |
entry_path = path + entry
|
|
527 |
if os.path.isdir(entry_path):
|
|
528 |
shutil.copytree(entry_path,
|
|
529 |
os.path.join(package_dir, entry))
|
|
530 |
else:
|
|
531 |
shutil.copy(entry_path, package_dir)
|
|
532 |
os.chdir(current_dir)
|
|
533 |
|
|
534 |
# Copy the sis files to `PyS60Dependencies` folder in
|
|
535 |
# c:\\Installer_Dependency.
|
|
536 |
for deps in package_dependencies:
|
|
537 |
deps_path = topdir + '\\build\\'
|
|
538 |
shutil.copy(deps_path + deps,
|
|
539 |
package_dependencies_dir + '\\' + deps)
|
|
540 |
|
|
541 |
def generate_setup():
|
|
542 |
# Installshield setup is created by calling 'IsCmdBld.exe'and then
|
|
543 |
# moved to build folder
|
|
544 |
os.chdir(installshield_dir)
|
|
545 |
print "Build the setup.exe by passing command line option"
|
|
546 |
installer_build_cmd = 'IsCmdBld.exe -p "%s" -r "%s" -c \
|
|
547 |
COMP -a "%s"' % (ism_path, release_name, project_configuration)
|
|
548 |
os.system(installer_build_cmd)
|
|
549 |
os.chdir(current_dir)
|
|
550 |
setup_file = 'PythonForS60_%s_%s_Setup.exe' % (version, version_tag)
|
|
551 |
setup_dir = 'PythonForS60\\%s\\Beta\\DiskImages\\DISK1' \
|
|
552 |
% project_configuration
|
|
553 |
os.rename(installer_dir + '%s\\setup.exe' % setup_dir,
|
|
554 |
installer_dir + '%s\\%s' % (setup_dir, setup_file))
|
|
555 |
shutil.copy(installer_dir +
|
|
556 |
'PythonForS60\\%s\\Beta\\DiskImages\\DISK1\\%s'
|
|
557 |
% (project_configuration, setup_file),
|
|
558 |
os.path.join(topdir, 'build', setup_file))
|
|
559 |
print "Installer Package Built"
|
|
560 |
|
|
561 |
def build_pys60_package():
|
|
562 |
# Create a Python for S60 package for Linux/Mac users
|
|
563 |
print "Building PythonForS60 package for Linux/Mac ..."
|
|
564 |
pys60_archive_dir = topdir + '\\build\\PythonForS60_package'
|
|
565 |
if not os.path.exists(pys60_archive_dir):
|
|
566 |
os.mkdir(pys60_archive_dir)
|
|
567 |
|
|
568 |
# Make a copy of both the PythonForS60 folder and PyS60Dependencies
|
|
569 |
# folder to create an archive
|
|
570 |
shutil.copytree(package_dir, pys60_archive_dir + '\\' +
|
|
571 |
os.path.basename(package_dir))
|
|
572 |
shutil.copytree(package_dependencies_dir, pys60_archive_dir +
|
|
573 |
'\\PythonForS60\\' + os.path.basename(package_dependencies_dir))
|
|
574 |
for path in files_not_in_pys60_archive:
|
|
575 |
for entry in files_not_in_pys60_archive[path]:
|
|
576 |
entry_path = path + entry
|
|
577 |
os.remove(entry_path)
|
|
578 |
create_archive_from_directory(topdir +
|
|
579 |
'\\build\\PythonForS60_%s_%s.tar.gz' % (version, version_tag),
|
|
580 |
pys60_archive_dir, archive_type='tar.gz')
|
|
581 |
print "PythonForS60 package built"
|
|
582 |
shutil.rmtree(pys60_archive_dir)
|
|
583 |
|
|
584 |
try:
|
|
585 |
generate_setup()
|
|
586 |
build_pys60_package()
|
|
587 |
finally:
|
|
588 |
print "Cleaning the folders after Installer generation is complete"
|
|
589 |
os.chdir(package_dependencies_dir)
|
|
590 |
for files in package_dependencies:
|
|
591 |
os.remove(files)
|
|
592 |
|
|
593 |
os.chdir(current_dir)
|
|
594 |
if os.path.exists(package_dir):
|
|
595 |
os.system("rmdir /S/Q " + package_dir)
|
|
596 |
|
|
597 |
|
|
598 |
def call_ensymble(tmp_dir, ensymble_options, flavour):
|
|
599 |
sign_cert = "..\\..\..\\..\\keys\\pythonteam.crt"
|
|
600 |
sign_key = "..\\..\..\\..\\keys\\pythonteam.key"
|
|
601 |
ensymble_cmd = "python ensymble.py py2sis %s %s" \
|
|
602 |
% (tmp_dir, ensymble_options)
|
|
603 |
# The first string in 'ensymble_options' has the scriptshell sis name
|
|
604 |
sis_name = ensymble_options.split(' ')[0]
|
|
605 |
try:
|
|
606 |
run_cmd(ensymble_cmd)
|
|
607 |
merge_example_scripts(sis_name)
|
|
608 |
if flavour == 'high_capas_pythonteam':
|
|
609 |
run_cmd("signsis %s %s %s %s"
|
|
610 |
% (sis_name, sis_name, sign_cert, sign_key))
|
|
611 |
except:
|
|
612 |
print "Error generating PythonScriptShell sis file."
|
|
613 |
raise
|
|
614 |
else:
|
|
615 |
print "PythonScriptShell sis file generated."
|
|
616 |
shutil.move(sis_name, topdir + "\\build")
|
|
617 |
|
|
618 |
|
|
619 |
def merge_example_scripts(sis_name):
|
|
620 |
run_cmd("dumpsis -x " + sis_name)
|
|
621 |
|
|
622 |
prev_dir = os.getcwd()
|
|
623 |
scriptshell_dir = os.path.join(prev_dir, sis_name.replace(".sis", ""))
|
|
624 |
os.chdir(os.path.join(prev_dir, scriptshell_dir))
|
|
625 |
|
|
626 |
scriptshell_pkg = sis_name.replace(".sis", ".pkg")
|
|
627 |
temp_pkg_file = "scriptshell.pkg"
|
|
628 |
|
|
629 |
# The pkg file generated by dumpsis command contains some non ascii
|
|
630 |
# characters, hence copying the pkg file content to a temporary file
|
|
631 |
# excluding those non ascii characters
|
|
632 |
type_cmd = "type %s > %s" % (scriptshell_pkg, temp_pkg_file)
|
|
633 |
run_cmd(type_cmd)
|
|
634 |
|
|
635 |
f = open(temp_pkg_file, 'a')
|
|
636 |
f.write('\n\n@"..\\..\\..\\..\\..\\internal-src\\' \
|
|
637 |
'dependency_sis_files\\PyS60ExampleScripts.sis"' \
|
|
638 |
', (0x20022EEA)')
|
|
639 |
f.close()
|
|
640 |
|
|
641 |
delete_file(scriptshell_pkg)
|
|
642 |
rename_file(temp_pkg_file, scriptshell_pkg)
|
|
643 |
|
|
644 |
run_cmd("makesis " + scriptshell_pkg)
|
|
645 |
shutil.move(sis_name, prev_dir)
|
|
646 |
|
|
647 |
os.chdir(prev_dir)
|
|
648 |
deltree_if_exists(scriptshell_dir)
|
|
649 |
|
|
650 |
|
|
651 |
def populate_scriptshell_scripts(tmp_dir):
|
|
652 |
scriptshell_dir = topdir + "\\ext\\amaretto\\scriptshell\\"
|
|
653 |
scriptshell_src = ['default.py', 'consolidated_imports.py']
|
|
654 |
|
|
655 |
deltree_if_exists(tmp_dir)
|
|
656 |
os.makedirs(tmp_dir)
|
|
657 |
|
|
658 |
for f in scriptshell_src:
|
|
659 |
print "Copying %s to %s" % (scriptshell_dir + f, tmp_dir)
|
|
660 |
shutil.copy(scriptshell_dir + f, tmp_dir)
|
|
661 |
# filebrowser.py imports dir_iter.py. So moving this file to scriptshell's
|
|
662 |
# private directory.
|
|
663 |
ex_file = topdir + "\\extras\\" + 'dir_iter.py'
|
|
664 |
shutil.copy(ex_file, tmp_dir)
|
|
665 |
|
|
666 |
|
|
667 |
def create_sdk_zip_31():
|
|
668 |
print "Creating sdk zip for 3.1 .."
|
|
669 |
platforms = ['30armv5']
|
|
670 |
build_utils.create_clean_env('\\Epoc32_3.1.zip')
|
|
671 |
sdk_zip_name = deliverables_name['32']['sdk_zip_name'][1] % \
|
|
672 |
(version, version_tag)
|
|
673 |
build_utils.unzip_file_into_dir(topdir + '\\build\\' + sdk_zip_name, '\\')
|
|
674 |
# Building only the socket
|
|
675 |
do_setupdotpy_configure('unsigned_high_capas', platforms[0])
|
|
676 |
run_cmd('python setup.py build ext\\amaretto\\socket\\group')
|
|
677 |
create_and_move_zip('31')
|
|
678 |
test_sdk_zip('_3_1')
|
|
679 |
shutil.rmtree("\\epoc32")
|
|
680 |
|
|
681 |
|
|
682 |
def generate_scriptshell_sis():
|
|
683 |
print "Building the PythonScriptShell sis files ..."
|
|
684 |
prev_dir = os.getcwd()
|
|
685 |
os.chdir(topdir + '\\tools\\py2sis\\ensymble')
|
|
686 |
|
|
687 |
app_name = "PythonScriptShell"
|
|
688 |
heap_size = "100K,16M"
|
|
689 |
vendor = "Nokia"
|
|
690 |
short_caption = "Python" + version
|
|
691 |
caption = "PythonScriptShell"
|
|
692 |
tmp_dir = "scriptshell_dir"
|
|
693 |
|
|
694 |
if integration_bld:
|
|
695 |
flavours = ['high_capas_pythonteam']
|
|
696 |
else:
|
|
697 |
flavours = ['unsigned_3_0', 'unsigned_3_2', 'unsigned_devcert',
|
|
698 |
'high_capas_pythonteam', 'unsigned_high_capas']
|
|
699 |
|
|
700 |
populate_scriptshell_scripts(tmp_dir)
|
|
701 |
|
|
702 |
for flavour in flavours:
|
|
703 |
if flavour in ['unsigned_3_0', 'unsigned_3_2',
|
|
704 |
'high_capas_pythonteam', 'unsigned_high_capas']:
|
|
705 |
uid = variants[flavour]['uid']
|
|
706 |
else:
|
|
707 |
uid = None
|
|
708 |
|
|
709 |
common_opt = "-v --appname=%s --version=%s --heapsize=%s " + \
|
|
710 |
"--vendor=%s --shortcaption=%s --caption=%s "
|
|
711 |
|
|
712 |
common_opt = common_opt % (app_name, version, heap_size, vendor,
|
|
713 |
short_caption, caption)
|
|
714 |
if uid is not None:
|
|
715 |
common_opt += ' --uid=' + uid
|
|
716 |
caps = variants[flavour]['capas'].replace(' ', '+')
|
|
717 |
if integration_bld:
|
|
718 |
sis_name = "PythonScriptShell_%s%s_%s.sis" % \
|
|
719 |
(version, version_tag, flavour)
|
|
720 |
else:
|
|
721 |
sis_name = "PythonScriptShell_%s_%s.sis" % (version, flavour)
|
|
722 |
options_for_ensymble = "%s --caps=%s %s" % (sis_name, caps, common_opt)
|
|
723 |
if integration_bld:
|
|
724 |
options_for_ensymble += " --ignore-missing-deps"
|
|
725 |
try:
|
|
726 |
call_ensymble(tmp_dir, options_for_ensymble, flavour)
|
|
727 |
except:
|
|
728 |
raise
|
|
729 |
|
|
730 |
deltree_if_exists(tmp_dir)
|
|
731 |
os.chdir(prev_dir)
|
|
732 |
|
|
733 |
|
|
734 |
def generate_ensymble_zip():
|
|
735 |
package_files = {'tools\\py2sis\\ensymble\\':
|
|
736 |
['ensymble.py', 'templates', 'README', 'module-repo']}
|
|
737 |
package_dir = topdir + '\\build\\ensymble_zip'
|
|
738 |
prev_dir = os.getcwd()
|
|
739 |
os.mkdir(package_dir)
|
|
740 |
for path in package_files:
|
|
741 |
for entry in package_files[path]:
|
|
742 |
entry_path = path + entry
|
|
743 |
if os.path.isdir(entry_path):
|
|
744 |
shutil.copytree(entry_path,
|
|
745 |
os.path.join(package_dir, entry))
|
|
746 |
else:
|
|
747 |
shutil.copy(entry_path, package_dir)
|
|
748 |
create_archive_from_directory(topdir + '\\build\\ensymble_%s_%s.zip' %
|
|
749 |
(version, version_tag), package_dir)
|
|
750 |
deltree_if_exists(package_dir)
|
|
751 |
os.chdir(prev_dir)
|
|
752 |
|
|
753 |
|
|
754 |
def test_sdk_zip(sdk_version):
|
|
755 |
sign_cert = "..\\..\..\\..\\keys\\pythonteam.crt"
|
|
756 |
sign_key = "..\\..\..\\..\\keys\\pythonteam.key"
|
|
757 |
caps_opt = ""
|
|
758 |
|
|
759 |
if sdk_version == '_3_0':
|
|
760 |
elemlist_sis_name = "elemlist_%s%s_3rdEd_alabs_pythonteam.sis" \
|
|
761 |
% (version, version_tag)
|
|
762 |
build_utils.create_clean_env('\\Epoc32_3.0.zip')
|
|
763 |
sdk_zip_name = 'Python_%s%s_SDK_3rdEdFP2.zip' % (version, version_tag)
|
|
764 |
caps_opt = ' --caps "%s"' % variants['alabs_pythonteam']['capas']
|
|
765 |
elif sdk_version == '_3_1':
|
|
766 |
elemlist_sis_name = "elemlist_%s%s_3rdEdFP1_alabs_pythonteam.sis" \
|
|
767 |
% (version, version_tag)
|
|
768 |
build_utils.create_clean_env('\\Epoc32_3.1.zip')
|
|
769 |
sdk_zip_name = 'Python_%s%s_SDK_3rdEdFP1.zip' % (version, version_tag)
|
|
770 |
caps_opt = ' --caps "%s"' % variants['alabs_pythonteam']['capas']
|
|
771 |
elif sdk_version == '_3_2':
|
|
772 |
elemlist_sis_name = "elemlist_%s%s_3rdEdFP2_alabs_pythonteam.sis" % \
|
|
773 |
(version, version_tag)
|
|
774 |
build_utils.create_clean_env('\\Epoc32_3.2.zip')
|
|
775 |
caps_opt = ' --caps "%s"' % variants['alabs_pythonteam']['capas']
|
|
776 |
sdk_zip_name = 'Python_%s%s_SDK_3rdEdFP2.zip' % (version, version_tag)
|
|
777 |
|
|
778 |
build_utils.unzip_file_into_dir(topdir + '\\build\\' + sdk_zip_name, '\\')
|
|
779 |
cmd_test = 'python setup.py test --testset-size 350 --sdk-version %s' % \
|
|
780 |
sdk_version
|
|
781 |
run_cmd(cmd_test, exception_on_error=0)
|
|
782 |
run_cmd('python setup.py configure --sdk 30armv5')
|
|
783 |
run_cmd('python setup.py build extras\\elemlist\\group')
|
|
784 |
run_cmd('python setup.py configure --sdk 30gcce' + caps_opt)
|
|
785 |
run_cmd('python setup.py build extras\\elemlist\\group')
|
|
786 |
|
|
787 |
os.chdir('extras\\elemlist\\group')
|
|
788 |
try:
|
|
789 |
run_cmd('makesis elemlist.pkg')
|
|
790 |
run_cmd('signsis elemlist.sis %s %s %s' % (elemlist_sis_name,
|
|
791 |
sign_cert, sign_key))
|
|
792 |
shutil.copy(elemlist_sis_name, '%s\\test\\%s' %
|
|
793 |
(python_readybuild_dir, elemlist_sis_name))
|
|
794 |
finally:
|
|
795 |
os.chdir(topdir)
|
|
796 |
|
|
797 |
|
|
798 |
def release_build():
|
|
799 |
global platforms
|
|
800 |
global gflavors
|
|
801 |
global without_src_zip
|
|
802 |
global installer
|
|
803 |
global variants
|
|
804 |
global internal_proj
|
|
805 |
global build_profile
|
|
806 |
|
|
807 |
build_profile = 'release'
|
|
808 |
#Build for emu first and then build for device
|
|
809 |
gflavors = ['unsigned_alabs', 'alabs_pythonteam']
|
|
810 |
platforms = ['30armv5']
|
|
811 |
do_clean_and_build_emu('white_choco', platforms, run_regrtest=False)
|
|
812 |
|
|
813 |
# When run-interpretertimer is built using GCCE on 3.0SDK the compilation
|
|
814 |
# fails as it complains that the application is nested too deeply in the
|
|
815 |
# drive. The same error is not seen on 3.2SDK. To workaround this 3.0SDK
|
|
816 |
# quirk we don't build internal projects instead of the arduous task of
|
|
817 |
# either renaming the exe or moving the project somewhere else.
|
|
818 |
orig_internal_proj_value = internal_proj
|
|
819 |
internal_proj = False
|
|
820 |
build_device_and_move_sis(gflavors, ['30gcce'], create_sis=False)
|
|
821 |
internal_proj = orig_internal_proj_value
|
|
822 |
|
|
823 |
build_device_and_move_sis(gflavors, platforms, False)
|
|
824 |
|
|
825 |
run_cmd('python setup.py generate_ensymble')
|
|
826 |
|
|
827 |
create_and_move_zip('30armv5')
|
|
828 |
|
|
829 |
# Building for 3.2 sdk
|
|
830 |
platforms = ['32']
|
|
831 |
build_utils.create_clean_env('\\Epoc32_3.2.zip')
|
|
832 |
sdk_zip_name = deliverables_name['30armv5']['sdk_zip_name'][1] % \
|
|
833 |
(version, version_tag)
|
|
834 |
final_sdk_zip_name = deliverables_name['32']['sdk_zip_name'][1] % \
|
|
835 |
(version, version_tag)
|
|
836 |
os.rename(topdir + '\\build\\' + sdk_zip_name,
|
|
837 |
topdir + '\\build\\' + final_sdk_zip_name)
|
|
838 |
build_utils.unzip_file_into_dir(topdir + '\\build' +
|
|
839 |
'\\Python_SDK_3rdEd_temp.zip',
|
|
840 |
'\\')
|
|
841 |
|
|
842 |
# Building only scriptext, sensorfw and iad_client on 3.2
|
|
843 |
proj = ['..\\internal-src\\scriptext\\group', 'ext\\sensorfw\\group',
|
|
844 |
'..\\internal-src\\iad_client\\group']
|
|
845 |
# Configure for 3.2 sdk
|
|
846 |
do_setupdotpy_configure('unsigned_alabs', platforms[0])
|
|
847 |
for x in proj:
|
|
848 |
run_cmd('python setup.py build ' + x)
|
|
849 |
|
|
850 |
create_deliverables_using_elftran(platforms[0], gflavors, True)
|
|
851 |
code_size.updatelog("3.0", python_readybuild_dir + "\\" +
|
|
852 |
deliverables_name['30armv5']['python_dll_sis_name'][1] %
|
|
853 |
(version, version_tag, gflavors[0]),
|
|
854 |
"C:\\Program Files\\CruiseControl\\logs\\codesize_metrics.log")
|
|
855 |
delete_file(topdir + '\\build\\Python_SDK_3rdEd_temp.zip')
|
|
856 |
|
|
857 |
pyd_path = '\\epoc32\\release\\winscw\\udeb\\'
|
|
858 |
zip_object = zipfile.ZipFile(topdir + '\\build\\' + final_sdk_zip_name,
|
|
859 |
'a')
|
|
860 |
zip_object.write(pyd_path + 'kf_scriptext.pyd',
|
|
861 |
pyd_path + 'kf_scriptext.pyd')
|
|
862 |
zip_object.close()
|
|
863 |
|
|
864 |
run_cmd('python setup.py generate_ensymble')
|
|
865 |
generate_scriptshell_sis()
|
|
866 |
test_sdk_zip('_3_2')
|
|
867 |
thread_pool = []
|
|
868 |
cmd_remote_buid = 'test_device_remote --work-area ' + \
|
|
869 |
python_readybuild_dir
|
|
870 |
build_commands = ['generate_docs', 'coverage', cmd_remote_buid]
|
|
871 |
|
|
872 |
for x, command in enumerate(build_commands):
|
|
873 |
thread_pool.append(RunBuildCmd(command))
|
|
874 |
thread_pool[x].setName(command)
|
|
875 |
for threads in thread_pool:
|
|
876 |
threads.start()
|
|
877 |
for threads in thread_pool:
|
|
878 |
threads.join()
|
|
879 |
if threads.getName() == 'generate_docs':
|
|
880 |
t = BuildInstaller()
|
|
881 |
t.start()
|
|
882 |
t.join()
|
|
883 |
create_sdk_zip_31()
|
|
884 |
build_utils.create_clean_env('\\Epoc32_3.0.zip')
|
|
885 |
if without_src_zip == False:
|
|
886 |
# Create src zip
|
|
887 |
zipname = '%s\\' % (python_readybuild_dir) + \
|
|
888 |
'pys60-%s%s_src.zip' % (version, version_tag)
|
|
889 |
create_archive_from_directory(zipname, os.getcwd(), 'src')
|
|
890 |
|
|
891 |
|
|
892 |
def set_integration_env():
|
|
893 |
global gflavors
|
|
894 |
global version_tag
|
|
895 |
global variants
|
|
896 |
# 3.2 devices have 'Location' capability as user-grantable using selfsigned
|
|
897 |
# certificate
|
|
898 |
if '30armv5' not in platforms:
|
|
899 |
variants['selfsigned']['capas'] += ' Location'
|
|
900 |
gflavors = ['alabs_pythonteam', 'unsigned_alabs']
|
|
901 |
svn_revision = get_svn_revision()
|
|
902 |
version_tag = 'svn' + svn_revision + '-integration'
|
|
903 |
|
|
904 |
|
|
905 |
def get_svn_revision():
|
|
906 |
out_put = run_shell_command('svnversion ' + PROJ_DIR)
|
|
907 |
[version, n] = out_put['stdout'].rsplit("\r")
|
|
908 |
return version
|
|
909 |
|
|
910 |
|
|
911 |
def del_mod_repo(topdir):
|
|
912 |
deltree_if_exists(os.path.abspath('tools\\py2sis\\ensymble\\module-repo'))
|
|
913 |
|
|
914 |
|
|
915 |
def integration_build():
|
|
916 |
global build_profile
|
|
917 |
del_mod_repo(topdir)
|
|
918 |
|
|
919 |
build_profile = 'integration'
|
|
920 |
|
|
921 |
do_clean_and_build_emu('white_choco', platforms)
|
|
922 |
build_device_and_move_sis(gflavors, platforms)
|
|
923 |
thread_pool = []
|
|
924 |
build_commands = []
|
|
925 |
if generate_docs:
|
|
926 |
build_commands.append('generate_docs')
|
|
927 |
if not without_ensymble:
|
|
928 |
build_commands.append('generate_ensymble')
|
|
929 |
for command in build_commands:
|
|
930 |
thread_pool.append(RunBuildCmd(command))
|
|
931 |
for threads in thread_pool:
|
|
932 |
threads.start()
|
|
933 |
for threads in thread_pool:
|
|
934 |
threads.join()
|
|
935 |
generate_ensymble_zip()
|
|
936 |
generate_scriptshell_sis()
|
|
937 |
for platform in platforms:
|
|
938 |
create_and_move_zip(platform)
|
|
939 |
if installer:
|
|
940 |
t = BuildInstaller()
|
|
941 |
t.start()
|
|
942 |
t.join()
|
|
943 |
|
|
944 |
|
|
945 |
def main():
|
|
946 |
if grelease:
|
|
947 |
release_build()
|
|
948 |
elif integration_bld:
|
|
949 |
integration_build()
|
|
950 |
else:
|
|
951 |
if target == 'emu':
|
|
952 |
do_clean_and_build_emu(gflavors, platforms)
|
|
953 |
elif target == 'device':
|
|
954 |
build_device_and_move_sis(gflavors, platforms)
|
|
955 |
else:
|
|
956 |
do_clean_and_build_emu(gflavors, platforms)
|
|
957 |
build_device_and_move_sis(gflavors, platforms)
|
|
958 |
|
|
959 |
log('builder.py - Please find the deliverables in directory: %s'
|
|
960 |
% python_readybuild_dir)
|
|
961 |
|
|
962 |
|
|
963 |
def show_configuration():
|
|
964 |
log('builder.py : The following values are considered for this build.\n'+
|
|
965 |
'Target -----------------> %s \n' % target +
|
|
966 |
'Version ----------------> %s \n' % version +
|
|
967 |
'Version tag ------------> %s \n' % version_tag +
|
|
968 |
'Build profile ----------> %s \n' % build_profile +
|
|
969 |
'Sdk --------------------> %s \n' % platforms +
|
|
970 |
'Work area --------------> %s \n' % python_readybuild_dir +
|
|
971 |
'Key dir ----------------> %s \n' % key_dir +
|
|
972 |
'Flavors ----------------> %s \n' % gflavors +
|
|
973 |
'Compile Docs flag ------> %s \n' % generate_docs +
|
|
974 |
'Integration build flag--> %s \n' % integration_bld +
|
|
975 |
'Release flag -----------> %s \n' % grelease +
|
|
976 |
'Compression type--------> %s \n' % compression_type +
|
|
977 |
'Profile log-------------> %s \n' % profiler +
|
|
978 |
'Include ..\internal_src-> %s \n' % include_internal_src +
|
|
979 |
'Without src zip---------> %s \n' % without_src_zip +
|
|
980 |
'Internal Projects-------> %s \n' % internal_proj +
|
|
981 |
'Without Ensymble--------> %s \n' % without_ensymble +
|
|
982 |
'Create Installer--------> %s \n' % installer)
|
|
983 |
|
|
984 |
|
|
985 |
if __name__=="__main__":
|
|
986 |
global target
|
|
987 |
global version
|
|
988 |
global version_tag
|
|
989 |
global platforms
|
|
990 |
global python_readybuild_dir
|
|
991 |
global key_dir
|
|
992 |
global gflavors
|
|
993 |
global generate_docs
|
|
994 |
global grelease
|
|
995 |
global integration_bld
|
|
996 |
|
|
997 |
working_dir = os.getcwd()
|
|
998 |
init_args(sys.argv)
|
|
999 |
create_readybuild_dirs()
|
|
1000 |
temp = time.strftime(python_readybuild_dir +
|
|
1001 |
"\\test\\pys60_build_log_%Y%m%d_%H%M.log")
|
|
1002 |
log_file = tee(temp, 'w')
|
|
1003 |
print time.strftime("Start Time: %a, %d %b %Y %H:%M:%S")
|
|
1004 |
show_configuration()
|
|
1005 |
main()
|
|
1006 |
print time.strftime("End Time: %a, %d %b %Y %H:%M:%S")
|
|
1007 |
log_file.close()
|
|
1008 |
del tee
|