author | jascui |
Wed, 17 Nov 2010 13:39:51 +0800 | |
changeset 688 | 27f7c5c966fc |
parent 625 | a1925fb7753a |
permissions | -rw-r--r-- |
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
1 |
# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
2 |
# All rights reserved. |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
3 |
# This component and the accompanying materials are made available |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
4 |
# under the terms of the License "Eclipse Public License v1.0" |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
5 |
# which accompanies this distribution, and is available |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
7 |
# |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
8 |
# Initial Contributors: |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
9 |
# Nokia Corporation - initial contribution. |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
10 |
# |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
11 |
# Contributors: |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
12 |
# |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
13 |
# Description: |
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
14 |
# Raptor installer maker script - generates a Windows installer for Raptor using |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
15 |
# the NSIS package in the accompanying directory. Works on Windows and Linux. |
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
16 |
|
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
17 |
import optparse |
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
18 |
import os |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
19 |
import os.path |
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
20 |
import re |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
21 |
import shutil |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
22 |
import stat |
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
23 |
import subprocess |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
24 |
import sys |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
25 |
import tempfile |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
26 |
import unzip |
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
27 |
import zipfile |
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
28 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
29 |
tempdir = "" |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
30 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
31 |
def generateinstallerversion(sbshome = None): |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
32 |
shellenv = os.environ.copy() |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
33 |
shellenv["PYTHONPATH"] = os.path.join(sbshome, "python") |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
34 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
35 |
raptorversioncommand = "python -c \"import raptor_version; print raptor_version.numericversion()\"" |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
36 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
37 |
# Raptor version is obtained from raptor_version module's numericversion function. |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
38 |
sbs_version_matcher = re.compile(".*(\d+\.\d+\.\d+).*", re.I) |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
39 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
40 |
# Create Raptor subprocess |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
41 |
versioncommand = subprocess.Popen(raptorversioncommand, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=shellenv) |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
42 |
raptorversion = "" |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
43 |
# Get all the lines matching the RE |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
44 |
for line in versioncommand.stdout.readlines(): |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
45 |
res = sbs_version_matcher.match(line) |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
46 |
if res: |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
47 |
raptorversion = res.group(1) |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
48 |
print "Successfully determined Raptor version %s" % raptorversion |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
49 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
50 |
versioncommand.wait() # Wait for process to end |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
51 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
52 |
return raptorversion |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
53 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
54 |
def unzipnsis(pathtozip): |
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
55 |
global tempdir |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
56 |
tempdir = tempfile.mkdtemp() |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
57 |
un = unzip.unzip() |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
58 |
print "Unzipping NSIS to %s..." % tempdir |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
59 |
un.extract(pathtozip, tempdir) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
60 |
print "Done." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
61 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
62 |
# Ensure the correct executable is called |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
63 |
dotexe="" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
64 |
if "win" in sys.platform.lower(): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
65 |
dotexe=".exe" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
66 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
67 |
makensispath = os.path.join(tempdir, "NSIS", "makensis" + dotexe) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
68 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
69 |
if not "win" in sys.platform.lower(): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
70 |
os.chmod(makensispath, stat.S_IRWXU) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
71 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
72 |
return makensispath |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
73 |
|
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
74 |
def runmakensis(nsiscommand): |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
75 |
# Create makensis subprocess |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
76 |
print "Running NSIS command\n%s" % nsiscommand |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
77 |
makensis = subprocess.Popen(nsiscommand, shell=True) |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
78 |
makensis.wait() # Wait for process to end |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
79 |
|
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
80 |
def cleanup(): |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
81 |
""" Clean up tempdir """ |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
82 |
global tempdir |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
83 |
print "Cleaning up temporary directory %s" % tempdir |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
84 |
shutil.rmtree(tempdir,True) |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
85 |
print "Done." |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
86 |
|
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
87 |
def __writeDirTreeToArchive(zip, dirlist, sbshome, win32supportdirs=False): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
88 |
"""Auxilliary function to write all files in each directory trees of dirlist into the |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
89 |
open archive "zip" assuming valid sbshome; destination path is tweaked for win32supportdirs, |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
90 |
so set this to true when writing files into $SBS_HOME/win32""" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
91 |
for name in dirlist: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
92 |
files = os.walk(os.path.join(sbshome, name)) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
93 |
for dirtuple in files: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
94 |
filenames = dirtuple[2] |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
95 |
dirname = dirtuple[0] |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
96 |
for file in filenames: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
97 |
# Filter out unwanted files |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
98 |
if not file.lower().endswith(".pyc") and \ |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
99 |
not file.lower().endswith(".project") and \ |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
100 |
not file.lower().endswith(".cproject") and \ |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
101 |
not file.lower().endswith(".pydevproject"): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
102 |
origin = os.path.join(dirname, file) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
103 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
104 |
# For the win32 support directories, the destination is different |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
105 |
if win32supportdirs: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
106 |
destination = os.path.join("sbs", "win32", os.path.basename(name.rstrip(os.sep)), |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
107 |
dirname.replace(name, "").strip(os.sep), file) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
108 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
109 |
destination = os.path.join("sbs", dirname.rstrip(os.sep).replace(sbshome, "").strip(os.sep), file) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
110 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
111 |
print "Compressing", origin, "\tto\t", destination |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
112 |
zip.write(origin, destination) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
113 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
114 |
def writeZip(filename, sbshome, sbsbvdir, sbscygwindir, sbsmingwdir, sbspythondir): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
115 |
"""Write a zip archive with file name "filename" assuming SBS_HOME is sbshome, and |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
116 |
that sbsbvdir, sbscygwindir, sbsmingwdir, sbspythondir are the win32 support directories.""" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
117 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
118 |
# *Files* in the top level SBS_HOME directory |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
119 |
sbshome_files = ["RELEASE-NOTES.html", "license.txt"] |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
120 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
121 |
# Directories in SBS_HOME |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
122 |
sbshome_dirs = ["bin", "examples", "lib", "notes", "python", |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
123 |
"schema", "style", os.sep.join(["win32", "bin"])] |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
124 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
125 |
# Win32 support directories |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
126 |
win32_dirs = [sbsbvdir, sbscygwindir, sbsmingwdir, sbspythondir] |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
127 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
128 |
try: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
129 |
# Open the zip archive for writing; if a file with the same |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
130 |
# name exists, it will be truncated to zero bytes before |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
131 |
# writing commences |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
132 |
zip = zipfile.ZipFile(filename, "w", zipfile.ZIP_DEFLATED) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
133 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
134 |
# Write the files in the top-level of SBS_HOME into the archive |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
135 |
for name in sbshome_files: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
136 |
origin = os.path.join(sbshome, name) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
137 |
destination = os.path.join("sbs", name) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
138 |
print "Compressing", origin, "\tto\t", destination |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
139 |
zip.write(origin, destination) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
140 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
141 |
# Write all files in the the directories in the top-level of SBS_HOME into the archive |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
142 |
print "Reading the sbs directories..." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
143 |
__writeDirTreeToArchive(zip, sbshome_dirs, sbshome, win32supportdirs=False) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
144 |
print "Writing sbs directories to the archive is complete." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
145 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
146 |
# Write all files in the the win32 support directories in the top-level of SBS_HOME into the archive |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
147 |
print "Reading the win32 support directories" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
148 |
__writeDirTreeToArchive(zip, win32_dirs, sbshome, win32supportdirs=True) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
149 |
print "Writing win32 support directories to the archive is complete." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
150 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
151 |
zip.close() |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
152 |
print "Zipoutput: \"" + os.path.join(os.getcwd(), filename) + "\"" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
153 |
print "Zip file creation successful." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
154 |
except Exception, e: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
155 |
print "Error: failed to create zip file: %s" % str(e) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
156 |
sys.exit(2) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
157 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
158 |
# Create CLI and parse it |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
159 |
parser = optparse.OptionParser() |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
160 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
161 |
parser.add_option("-s", "--sbs-home", dest="sbshome", help="Path to use as SBS_HOME environment variable. If not present the script exits.") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
162 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
163 |
parser.add_option("-w", "--win32-support", dest="win32support", help="Path to Win32 support directory. If not present the script exits.") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
164 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
165 |
parser.add_option("-b", "--bv", dest="bv", help="Path to Binary variation CPP \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
166 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
167 |
parser.add_option("-c", "--cygwin", dest="cygwin", help="Path to Cygwin \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
168 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
169 |
parser.add_option("-m", "--mingw", dest="mingw", help="Path to MinGW \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
170 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
171 |
parser.add_option("-p", "--python", dest="python", help="Path to Python \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
172 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
173 |
parser.add_option("--prefix", dest="versionprefix", help="A string to use as a prefix to the Raptor version string. This will be present in the Raptor installer's file name, the installer's pages as well as the in output from sbs -v.", type="string", default="") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
174 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
175 |
parser.add_option("--postfix", dest="versionpostfix", help="A string to use as a postfix to the Raptor version string. This will be present in the Raptor installer's file name, the installer's pages as well as the in output from sbs -v.", type="string", default="") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
176 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
177 |
parser.add_option("--noclean", dest="noclean", help="Do not clean up the temporary directory created during the run.", action="store_true" , default=False) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
178 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
179 |
parser.add_option("--noexe", dest="noexe", help="Do not create a Windows .exe installer of the Raptor installation.", action="store_true" , default=False) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
180 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
181 |
parser.add_option("--nozip", dest="nozip", help="Do not create a zip archive of the Raptor installation.", action="store_true" , default=False) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
182 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
183 |
(options, args) = parser.parse_args() |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
184 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
185 |
# Required directories inside the win32-support directory (i.e. the win32-support repository). |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
186 |
win32supportdirs = {"bv":"bv", "cygwin":"cygwin", "mingw":"mingw", "python":"python264"} |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
187 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
188 |
if options.sbshome == None: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
189 |
print "ERROR: no SBS_HOME passed in. Exiting..." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
190 |
sys.exit(2) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
191 |
elif not os.path.isdir(options.sbshome): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
192 |
print "ERROR: the specified SBS_HOME directory \"%s\" does not exist. Cannot build installer. Exiting..." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
193 |
sys.exit(2) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
194 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
195 |
if options.win32support == None: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
196 |
print "ERROR: no win32support directory specified. Unable to proceed. Exiting..." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
197 |
sys.exit(2) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
198 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
199 |
# Check for command line overrides to defaults |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
200 |
for directory in win32supportdirs: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
201 |
print "Checking for location \"%s\"..." % directory |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
202 |
value = getattr(options,directory) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
203 |
print "Directory is %s" % str(value) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
204 |
if value != None: # Command line override |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
205 |
if value.lower().startswith("win32support"): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
206 |
# Strip off "WIN32SUPPORT\" and join to Win32 support location |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
207 |
win32supportdirs[directory] = os.path.join(options.win32support, value[13:]) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
208 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
209 |
# Relative to current directory |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
210 |
win32supportdirs[directory] = value |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
211 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
212 |
else: # Use default location |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
213 |
win32supportdirs[directory] = os.path.join(options.win32support, win32supportdirs[directory]) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
214 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
215 |
print "\n\nIdentified win32supportdirs are = %s\n\n" % win32supportdirs |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
216 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
217 |
# Check that all the specified directories exist and exit if any of them is missing. |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
218 |
for directory in win32supportdirs: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
219 |
dir = win32supportdirs[directory] |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
220 |
if os.path.isdir(dir): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
221 |
print "Found directory %s" % dir |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
222 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
223 |
print "ERROR: directory %s does not exist. Cannot build installer. Exiting..." % dir |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
224 |
sys.exit(2) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
225 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
226 |
|
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
227 |
raptorversion = options.versionprefix + generateinstallerversion(options.sbshome) + options.versionpostfix |
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
228 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
229 |
print "Using Raptor version %s ..." % raptorversion |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
230 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
231 |
if not options.noexe: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
232 |
makensispath = unzipnsis("." + os.sep + "NSIS.zip") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
233 |
if "win" in sys.platform.lower(): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
234 |
switch="/" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
235 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
236 |
switch="-" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
237 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
238 |
nsiscommand = (makensispath + " " + |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
239 |
switch + "DRAPTOR_LOCATION=%s " + |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
240 |
switch + "DBV_LOCATION=%s " + |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
241 |
switch + "DCYGWIN_LOCATION=%s " + |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
242 |
switch + "DMINGW_LOCATION=%s " + |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
243 |
switch + "DPYTHON_LOCATION=%s " + |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
244 |
switch + "DRAPTOR_VERSION=%s " + |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
245 |
"%s" ) % \ |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
246 |
( options.sbshome, |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
247 |
win32supportdirs["bv"], |
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
248 |
win32supportdirs["cygwin"], |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
249 |
win32supportdirs["mingw"], |
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
250 |
win32supportdirs["python"], |
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
251 |
raptorversion, |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
252 |
os.path.join(options.sbshome, "util", "install-windows", "raptorinstallerscript.nsi") |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
253 |
) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
254 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
255 |
# On Linux, we need to run makensis via Bash, so that is can find all its |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
256 |
# internal libraries and header files etc. Makensis fails unless it |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
257 |
# is executed this way on Linux. |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
258 |
if "lin" in sys.platform.lower(): |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
259 |
nsiscommand = "bash -c \"%s\"" % nsiscommand |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
260 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
261 |
runmakensis(nsiscommand) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
262 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
263 |
print "Not creating .exe as requested." |
590
360bd6b35136
buildrom v3.24.0, rombuild v2.17.3, rofsbuild v2.10.4, resource compiler v8.4.001, image check v1.4.0, elftools v2.3, elf2e32 v2.3
jjkang
parents:
0
diff
changeset
|
264 |
|
625
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
265 |
# Only clean NSIS installation in the temporary directory if requested |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
266 |
if not options.noclean: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
267 |
cleanup() |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
268 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
269 |
print "Not cleaning makensis in %s" % makensispath |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
270 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
271 |
# Only create zip archive if required |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
272 |
if not options.nozip: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
273 |
filename = "sbs-" + raptorversion + ".zip" |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
274 |
writeZip(filename, options.sbshome, win32supportdirs["bv"], win32supportdirs["cygwin"], win32supportdirs["mingw"], win32supportdirs["python"]) |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
275 |
else: |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
276 |
print "Not creating zip archive as requested." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
277 |
|
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
278 |
print "Finished." |
a1925fb7753a
sbs version 2.15.0
Richard Taylor <richard.i.taylor@nokia.com>
parents:
590
diff
changeset
|
279 |