forked from tweecode/twine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildexe.py
99 lines (86 loc) · 3.17 KB
/
buildexe.py
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
# This builds an .exe out of Tweebox for use with Windows.
# Call this with this command line: buildexe.py
# py2exe is inserted as a command line parameter automatically.
import sys, os, py2exe
from distutils.core import setup
from version import versionString
manifest = '''
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.3.5.1"
processorArchitecture="x86"
name="%(prog)s"
type="win32"
/>
<description>%(prog)s Program</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.30729.6161"
processorArchitecture="X86"
publicKeyToken="1fc8b3b9a1e18e3b"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
'''
# Force use of py2exe for building Win32.exe
sys.argv.append('py2exe')
# Clear out the dist/win32 directory
for root, dirs, files in os.walk('dist' + os.sep + 'win32', topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
# Build the exe
setup(
name = 'Twine',
description = 'Twine',
version = versionString,
windows = [{
'script': 'app.py',
'icon_resources': [(0x0004, 'appicons\\app.ico'), (0x0005, 'appicons\\doc.ico')],
'dest_base': 'twine',
'other_resources': [(24, 1, manifest % dict(prog='Twine'))],
}],
data_files = [
('targets' + os.sep + 'jonah', ['targets' + os.sep + 'jonah' + os.sep + 'header.html',
'targets' + os.sep + 'jonah' + os.sep + 'code.js']),
('targets' + os.sep + 'sugarcane', ['targets' + os.sep + 'sugarcane' + os.sep + 'header.html',
'targets' + os.sep + 'sugarcane' + os.sep + 'code.js']),
('targets' + os.sep + 'Responsive', ['targets' + os.sep + 'Responsive' + os.sep + 'header.html']),
('targets', [
'targets' + os.sep + 'engine.js',
'targets' + os.sep + 'jquery.js',
'targets' + os.sep + 'modernizr.js']),
('icons', [
# toolbar icons
'icons' + os.sep + 'newpassage.png',
'icons' + os.sep + 'zoomin.png',
'icons' + os.sep + 'zoomout.png',
'icons' + os.sep + 'zoomfit.png',
'icons' + os.sep + 'zoom1.png',
'icons' + os.sep + 'zoomfit.png',
# other icons
'icons' + os.sep + 'brokenemblem.png',
'icons' + os.sep + 'externalemblem.png',
'appicons' + os.sep + 'app.ico',
]),
],
options = {
'py2exe': {
'dist_dir': 'dist' + os.sep + 'win32',
'bundle_files': 3,
'optimize': 2,
'ignores': ['_scproxy'],
'dll_excludes': ['w9xpopen.exe', 'MSVCP90.dll'],
'compressed': True,
}
},
zipfile = 'library.zip',
)
print 'Check the ./dist/win32 folder'