forked from defold/defold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
71 lines (60 loc) · 2.17 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
#! /usr/bin/env python
VERSION='0.1'
APPNAME='docs'
srcdir = '.'
blddir = 'build'
import waflib.Utils
import sys, os, re, fnmatch
import waflib.Options
import waf_dynamo
import TestContext
test_context = None
def init(ctx):
global test_context
if 'build' in waflib.Options.commands:
test_context = TestContext.create_test_context()
def configure(conf):
conf.recurse('src')
pass
def clean(conf):
# Clean up src
files = os.listdir('src')
for filename in fnmatch.filter(files, '*.apidoc_'):
os.remove(os.path.join('src', filename))
def build(bld):
global test_context
# Clean up src
files = os.listdir('src')
for filename in fnmatch.filter(files, '*.apidoc_'):
os.remove(os.path.join('src', filename))
# Find all the built .apidoc files in the engine tree
apidoc_files = []
for root, dirs, files in os.walk('..'):
for filename in fnmatch.filter(files, '*.apidoc'):
apidoc_files.append(os.path.join(root, filename))
# Concat per namespace into 'src'
namespace_files = {}
for apidoc_file in apidoc_files:
namespace, _ = os.path.splitext(os.path.basename(apidoc_file))
if namespace not in namespace_files:
namespace_files[namespace] = []
namespace_files[namespace].append(apidoc_file)
for ns, files in namespace_files.items():
comments = '\n'.join([waflib.Utils.readf(f) for f in files])
with open('src/%s.apidoc_' % ns, 'w') as out_f:
out_f.write(comments)
bld.recurse('src')
TestContext.initialize_test_context(test_context, bld)
def options(opt):
opt.recurse('src')
opt.load('waf_dynamo')
opt.add_option('--skip-tests', action='store_true', default=False, dest='skip_tests', help='skip unit tests')
def shutdown(self):
if not TestContext.is_valid(test_context):
return
if not getattr(waflib.Options.options, 'skip_tests', False):
python_path = os.environ.get('PYTHONPATH', '')
os.environ['PYTHONPATH'] = 'src' + os.pathsep + 'build/default/src' + os.pathsep + python_path
ret = os.system('python %s' % 'src/test/test_script_doc.py')
if ret != 0:
sys.exit(1)