forked from ChicagoDave/quixe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.py
executable file
·48 lines (41 loc) · 1.22 KB
/
build.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
#!/usr/bin/env python
# Quixe build script.
#
# This packs together all the Javascript source into two files, using
# rjsmin. As a special bonus, lines (or part-lines) beginning with
# ';;;' are stripped out. We use this to get rid of debugging log statements
# and assertions.
import sys
import re
import subprocess
regex_debug = re.compile(';;;.+$', re.M)
def compress_source(target, srcls):
print 'Writing', target
targetfl = open(target, 'w')
proc = subprocess.Popen(['python', 'tools/rjsmin.py'],
stdin=subprocess.PIPE,
stdout=targetfl)
for src in srcls:
fl = open(src)
dat = fl.read()
dat = regex_debug.sub('', dat)
fl.close()
proc.stdin.write(dat)
proc.stdin.close()
ret = proc.wait()
if (ret):
raise Exception('Process result code %d' % (ret,))
targetfl.close()
compress_source(
'lib/glkote.min.js', [
'src/prototype-1.6.1.js',
'src/glkote/glkote.js',
'src/glkote/dialog.js',
'src/glkote/glkapi.js',
])
compress_source(
'lib/quixe.min.js', [
'src/quixe/quixe.js',
'src/quixe/gi_dispa.js',
'src/quixe/gi_load.js',
])