-
Notifications
You must be signed in to change notification settings - Fork 86
/
SConscript.dist
112 lines (96 loc) · 4.12 KB
/
SConscript.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Import('build')
import os.path as path
import effess
import os
import tarfile
import zipfile
import sys
from glob import glob
from StringIO import StringIO
sdk_dir = path.join(build.dir, 'sdk')
excludes = ['.pdb', '.exp', '.ilk', '.db', '.gitignore','.psd', '.xib'
'.cpp', '.obj', '.pyc', 'SConscript', '.xib']
# Copy the SDK files to the SDK build directory.
# This prepares the SDK directory for packaging.
if not(path.exists(sdk_dir)):
os.makedirs(sdk_dir)
effess.lightweight_copy_tree(path.join(build.titanium_sdk_dir, build.os),
sdk_dir, exclude=excludes)
effess.copy_to_dir(glob(path.join(build.titanium_sdk_dir, "google_closure")),
sdk_dir, exclude=excludes)
effess.copy_to_dir(glob(path.join(build.titanium_sdk_dir, "*.py")),
sdk_dir, exclude=excludes)
effess.copy_to_dir(glob(path.join(build.titanium_sdk_dir, "PyRTF")),
sdk_dir, exclude=excludes)
effess.copy_to_dir(glob(path.join(build.kroll_source_dir, 'tools', "effess.py")),
sdk_dir, exclude=excludes)
if build.is_osx():
os.system('ibtool --errors --warnings --notices ' + \
'--output-format human-readable-text --compile %s %s' % \
(path.join(sdk_dir, 'MainMenu.nib'),
path.join(build.titanium_sdk_dir, 'osx', 'MainMenu.xib')))
if build.is_win32():
effess.copy_to_dir(build.tp('microsoft', 'Microsoft_VC80_CRT_x86.msm'),
path.join(sdk_dir, 'installer'))
# Network installable zip files for distribution. We must
# encase this in a builder because the files necessary for zipping
# don't exist when this file is processed.
def build_dist_zips(target, source, env):
f = path.join(build.dist_dir, 'runtime-%s.zip' % build.version)
if not(path.isdir(build.dist_dir)):
os.makedirs(build.dist_dir)
print "Packing %s" % f
effess.make_zip(build.runtime_build_dir, f, exclude=excludes)
for m in build.modules:
f = path.join(build.dist_dir, 'module-%s-%s.zip' % (m.name, m.version))
print "Packing %s" % f
effess.make_zip(m.dir, f, exclude=excludes)
def add_files_to_archive(archive, add_to_archive):
def addFile(file):
add_to_archive(archive, file,
'/'.join([current_archive_prefix, file.replace(current_prefix, '')]))
current_prefix = build.runtime_build_dir
current_archive_prefix = '/'.join(['runtime', build.os, build.version])
effess.walk_dir(build.runtime_build_dir, addFile, exclude=excludes, dirs=True)
for m in build.modules:
current_prefix = m.dir
current_archive_prefix = '/'.join(['modules', build.os, m.name, build.version])
effess.walk_dir(m.dir, addFile, exclude=excludes, dirs=True)
current_prefix = sdk_dir
current_archive_prefix = '/'.join(['sdk', build.os, build.version])
effess.walk_dir(sdk_dir, addFile, exclude=excludes, dirs=True)
def build_sdk(target, source, env):
zip_file_path = path.join(build.dist_dir, 'sdk-%s.zip' % build.version)
print "Packing SDK (%s) " % zip_file_path
zip_file = zipfile.ZipFile(zip_file_path, 'w', zipfile.ZIP_DEFLATED)
add_files_to_archive(zip_file, effess.add_to_zip)
zip_file.close()
def build_packaging_tools(target, source, env):
tgz_file_path = path.join(build.dist_dir, 'packaging_tools-%s.tgz' % build.version)
print "Packing packaging tools (%s) " % tgz_file_path
tgz_file = tarfile.open(tgz_file_path, 'w:gz')
add_files_to_archive(tgz_file, effess.add_to_tgz)
tgz_file.addfile(tarfile.TarInfo(
'/'.join(['sdk', build.os, build.version, '.packager'])),
StringIO('#'))
tgz_file.close()
# Builder for all module and runtime component zip files
build.env.Append(BUILDERS =
{'BuildDistZips' : Builder(action=build_dist_zips)})
zips = build.env.BuildDistZips('#dummy-dist-zips', [])
build.mark_dist_target(zips)
AlwaysBuild(zips)
# Builder for SDK component zip file
build.env.Append(BUILDERS =
{'BuildSDK' : Builder(action=build_sdk)})
sdk_target = build.env.BuildSDK('build-sdk', [])
build.env.Depends(sdk_target, zips)
build.mark_dist_target(sdk_target)
AlwaysBuild(sdk_target)
# Builder for packaging tools tgz file
build.env.Append(BUILDERS =
{'BuildPackagingTools' : Builder(action=build_packaging_tools)})
packaging_tools_target = build.env.BuildPackagingTools('build-pkg-tools', [])
build.env.Depends(packaging_tools_target, zips)
build.mark_dist_target(packaging_tools_target)
AlwaysBuild(packaging_tools_target)