source: rtems-docs/wscript @ 5d8b0dd

5
Last change on this file since 5d8b0dd was 5d8b0dd, checked in by Chris Johns <chrisj@…>, on 02/12/19 at 23:18:43

waf: Remove as many sys path hacks as we can.

There are still sys.path hacks in the conf.py files. They cannot
be removed because the instance of python running the sphinx-build
command does not see our top level path hacks. I looked at using
PYTHONPATH but I could not figure out how to set a process environ
var for a waf build instance.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1#
2# RTEMS Project Documentation
3#
4
5import sys
6import os.path
7
8import waflib
9
10from common import waf as docs_waf
11from common import version
12
13#
14# Branch version
15#
16rtems_major_version = '5'
17
18#
19# Set Python's system path to `common` from the top level so the
20# conf.py modules in subdirectories can be found. See xml_catalogue in
21# common/waf.py.
22#
23sys.path.append(os.path.abspath('common'))
24
25#
26# The documents to build.
27#
28build_all = ['user',
29             'c-user',
30             'bsp-howto',
31             'posix-users',
32             'posix-compliance',
33             'eng',
34             'filesystem',
35             'networking',
36             'shell',
37             'cpu-supplement',
38             'develenv',
39             'eclipse']
40
41building = build_all
42
43def options(opt):
44    docs_waf.cmd_options(opt)
45
46def configure(conf):
47    for b in building:
48        conf.recurse(b)
49    conf.env['BUILD_FROM_TOP'] = 'yes'
50
51def catalogue(ctx):
52    docs_waf.xml_catalogue(ctx, building)
53
54def coverpage_js(ctx):
55    js = None
56    xml = None
57    for f in ctx.inputs:
58        if f.abspath().endswith('.js'):
59            with open(f.abspath()) as i:
60                js = i.read()
61        elif f.abspath().endswith('.xml'):
62            with open(f.abspath()) as i:
63                xml = i.read()
64    xml = xml.replace('\n', ' \\\n');
65    with open(ctx.outputs[0].abspath(), 'w') as o:
66        o.write(js.replace('@CATALOGUE', xml))
67
68
69def build(ctx):
70    #
71    # Get the version.
72    #
73    ver_version, ver_date, ver_released = version.get(ctx, rtems_major_version)
74    ctx.env.DATE = ver_date
75    ctx.env.RELEASE = ver_version + ' (' + ver_date + ')'
76    ctx.env.VERSION = ver_version
77    ctx.to_log('Build: %s%s' % (ctx.env.RELEASE, os.linesep))
78
79    #
80    #
81    # Generate any PlantUML images if enabled.
82    #
83    ctx.recurse('images')
84    ctx.add_group('images')
85
86    for b in building:
87        ctx.recurse(b)
88
89    #
90    # Build the catalogue, coverpage.js and install.
91    #
92    ctx(rule = catalogue,
93        target = 'catalogue.xml',
94        source = ['wscript', 'common/waf.py'] + ['%s/conf.py' % x for x in building])
95    ctx.install_files('${PREFIX}', 'catalogue.xml')
96    ctx(rule = coverpage_js,
97        target = 'coverpage.js',
98        source = ['wscript', 'catalogue.xml', 'common/coverpage/coverpage.js'])
99    ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js')
100    #
101    # Install the static content.
102    #
103    ctx.install_as('${PREFIX}/index.html', 'common/coverpage/coverpage.html')
104    static_dir = ctx.path.find_dir('common/coverpage/static')
105    ctx.install_files('${PREFIX}/static',
106                      static_dir.ant_glob('**'),
107                      cwd = static_dir,
108                      relative_trick = True)
109
110def install(ctx):
111    for b in building:
112        ctx.recurse(b)
113
114def cmd_spell(ctx):
115    for b in building:
116        ctx.recurse(b)
117
118def cmd_linkcheck(ctx):
119    for b in building:
120        ctx.recurse(b)
Note: See TracBrowser for help on using the repository browser.