3 # SPDX-License-Identifier: MIT
5 # Copyright The SCons Foundation
7 # Searches through the whole source tree and updates
8 # the generated *.gen/*.mod files in the docs folder, keeping all
9 # documentation for the tools, builders and functions...
10 # as well as the entity declarations for them.
11 # Uses scons-proc.py under the hood...
19 # Directory where all generated files are stored
20 gen_folder
= os
.path
.join('doc', 'generated')
23 """ Return the argument pair *.gen,*.mod for the given key. """
25 os
.path
.join(gen_folder
, '%s.gen' % key
),
26 os
.path
.join(gen_folder
, '%s.mod' % key
),
32 """Generate the entity files.
34 Scan for XML files in the SCons directory and call scons-proc.py
35 to generate the *.gen/*.mod files from it.
38 for path
, dirs
, files
in os
.walk('SCons'):
40 if f
.endswith('.xml'):
41 fpath
= os
.path
.join(path
, f
)
42 if SConsDoc
.isSConsXml(fpath
):
46 # Does the destination folder exist
48 os
.makedirs(gen_folder
, exist_ok
=True)
50 print("Couldn't create destination folder %s! Exiting..." % gen_folder
, file=sys
.stdout
)
57 os
.path
.join('bin', 'scons-proc.py'),
58 '-b', argpair('builders'),
59 '-f', argpair('functions'),
60 '-t', argpair('tools'),
61 '-v', argpair('variables'),
67 print("Generation failed", file=sys
.stderr
)
72 if __name__
== "__main__":
73 if not generate_all():