source: rtems-docs/wscript @ 60ed99d

Last change on this file since 60ed99d was 60ed99d, checked in by Sebastian Huber <sebastian.huber@…>, on Jan 11, 2019 at 9:20:08 AM

user: Add RSB content as a chapter

Remove the separate RSB manual.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1#
2# RTEMS Project Documentation
3#
4
5from sys import path
6from os.path import abspath
7path.append(abspath('common'))
8
9import waflib
10import waf as docs_waf
11
12build_all = ['user',
13             'c-user',
14             'bsp-howto',
15             'posix-users',
16             'posix-compliance',
17             'eng',
18             'filesystem',
19             'networking',
20             'shell',
21             'cpu-supplement',
22             'develenv',
23             'eclipse']
24
25building = build_all
26
27def options(opt):
28    docs_waf.cmd_options(opt)
29
30def configure(conf):
31    for b in building:
32        conf.recurse(b)
33    conf.env['BUILD_FROM_TOP'] = 'yes'
34
35def catalogue(ctx):
36    docs_waf.xml_catalogue(ctx, building)
37
38def coverpage_js(ctx):
39    js = None
40    xml = None
41    for f in ctx.inputs:
42        if f.abspath().endswith('.js'):
43            with open(f.abspath()) as i:
44                js = i.read()
45        elif f.abspath().endswith('.xml'):
46            with open(f.abspath()) as i:
47                xml = i.read()
48    xml = xml.replace('\n', ' \\\n');
49    with open(ctx.outputs[0].abspath(), 'w') as o:
50        o.write(js.replace('@CATALOGUE', xml))
51
52def pretty_day(day):
53    if day == 3:
54        s = 'rd'
55    elif day == 11:
56        s = 'th'
57    elif day == 12:
58        s = 'th'
59    elif day == 13:
60        s = 'th'
61    elif day % 10 == 1:
62        s = 'st'
63    elif day % 10 == 2:
64        s = 'nd'
65    else:
66        s = 'th'
67    return str(day) + s
68
69def build(ctx):
70    #
71    # Get date and version from Git
72    #
73    version = '5.0.0'
74    if ctx.exec_command(['git', 'diff-index', '--quiet', 'HEAD']) == 0:
75        modified = ''
76    else:
77        modified = '-modified'
78    try:
79        out = ctx.cmd_and_log(['git', 'log', '-1', '--format=%H,%cd', '--date=format:%e,%B,%Y'])
80        f = out.strip('\n').split(',')
81        version = version + '.' + f[0] + modified
82        date = pretty_day(int(f[1])) + ' ' + f[2] + ' ' + f[3]
83    except waflib.Build.Errors.WafError:
84        date = 'unknown date'
85    ctx.env.DATE = date
86    ctx.env.RELEASE = version + ' (' + date + ')'
87    ctx.env.VERSION = version
88
89    #
90    # Generate any PlantUML images if enabled.
91    #
92    ctx.recurse('images')
93    ctx.add_group('images')
94
95    for b in building:
96        ctx.recurse(b)
97
98    #
99    # Build the catalogue, coverpage.js and install.
100    #
101    ctx(rule = catalogue,
102        target = 'catalogue.xml',
103        source = ['wscript', 'common/waf.py'] + ['%s/conf.py' % x for x in building])
104    ctx.install_files('${PREFIX}', 'catalogue.xml')
105    ctx(rule = coverpage_js,
106        target = 'coverpage.js',
107        source = ['wscript', 'catalogue.xml', 'common/coverpage/coverpage.js'])
108    ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js')
109    #
110    # Install the static content.
111    #
112    ctx.install_as('${PREFIX}/index.html', 'common/coverpage/coverpage.html')
113    static_dir = ctx.path.find_dir('common/coverpage/static')
114    ctx.install_files('${PREFIX}/static',
115                      static_dir.ant_glob('**'),
116                      cwd = static_dir,
117                      relative_trick = True)
118
119def install(ctx):
120    for b in building:
121        ctx.recurse(b)
122
123def cmd_spell(ctx):
124    for b in building:
125        ctx.recurse(b)
126
127def cmd_linkcheck(ctx):
128    for b in building:
129        ctx.recurse(b)
Note: See TracBrowser for help on using the repository browser.