-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
118 lines (71 loc) · 2.91 KB
/
wscript
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
113
114
115
116
117
118
"""
"""
import buildmeta
top = '.'
out = 'build'
SERVER_TARGETS = ('py_server', 'fms')
CLIENT_TARGETS = ('swf', 'py_client')
# supported protocols
PROTOCOLS = ('rtmp',)
AMF_VERSIONS = ('0', 3)
def options(ctx):
ctx.add_option('--server', action='store',
help='A server component to build (and test). Choose one from %r' % (
SERVER_TARGETS,))
ctx.add_option('--client', action='store',
help='A client component to build (and test). Choose one from %r' % (
CLIENT_TARGETS,))
ctx.add_option('--protocol', action='store', default='rtmp',
help='Protocol to test. Choose ONE from %r.' % (PROTOCOLS,))
ctx.add_option('--remote_host', action='store', help='The hostname that '
'will be used by the client target to connect to the server target')
ctx.add_option('--amf_encoding', action='store', help='The AMF version used '
'to connect to the server target', default='0')
for target in SERVER_TARGETS + CLIENT_TARGETS:
ctx.load(target, tooldir='buildmeta')
def configure(ctx):
server_target = ctx.options.server
if not server_target:
ctx.fatal('--server is a required argument.')
if server_target not in SERVER_TARGETS:
ctx.fatal('Unknown server target %r.' % (server_target,))
ctx.env.SERVER_TARGET = server_target
client_target = ctx.options.client
if not client_target:
ctx.fatal('--client is a required argument.')
if client_target not in CLIENT_TARGETS:
ctx.fatal('Unknown client target %r.' % (client_target,))
ctx.env.CLIENT_TARGET = client_target
protocol = ctx.options.protocol
if not protocol:
ctx.fatal('--protocol is a required argument.')
if protocol not in PROTOCOLS:
ctx.fatal('Unknown protocol %r.' % (protocol,))
ctx.env.PROTOCOL = protocol
amf_encoding = ctx.options.amf_encoding
if not amf_encoding:
ctx.fatal('--amf_encoding is a required argument.')
if amf_encoding not in AMF_VERSIONS:
ctx.fatal('Unknown AMF encoding %r.' % (amf_encoding,))
remote_host = ctx.options.remote_host
if not remote_host:
ctx.fatal('--remote_host is a required argument.')
# parse remote_host for host:port
host = remote_host
port = '1935'
res = remote_host.split(':')
if res[0] != remote_host:
host, port = res
ctx.env.REMOTE_SERVER = host + ':' + port
ctx.msg('Setting REMOTE_SERVER', ctx.env.REMOTE_SERVER)
ctx.load('python')
ctx.check_python_module('jinja2')
for target in [ctx.env.SERVER_TARGET, ctx.env.CLIENT_TARGET]:
ctx.load(target, tooldir='buildmeta')
def build(ctx):
buildmeta.build_runner(ctx)
buildmeta.build_proxy(ctx)
buildmeta.clear_test_file(ctx)
for target in [ctx.env.SERVER_TARGET, ctx.env.CLIENT_TARGET]:
ctx.load(target, tooldir='buildmeta')
buildmeta.write_test_file(ctx, buildmeta.get_tests(ctx))