Changeset 916d295 in rtems-docs
- Timestamp:
- 01/09/17 12:13:02 (6 years ago)
- Branches:
- 4.11
- Children:
- f08d4c1
- Parents:
- 2c5cfad
- git-author:
- Chris Johns <chrisj@…> (01/09/17 12:13:02)
- git-committer:
- Chris Johns <chrisj@…> (01/10/17 11:38:23)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/waf.py
r2c5cfad r916d295 87 87 output_dir = output_node.abspath() 88 88 doctrees = os.path.join(os.path.dirname(output_dir), 'doctrees', buildtype) 89 # 90 # Gather the data for the catalogue 91 # 92 if build_dir not in ctx.catalogue: 93 ctx.catalogue[build_dir] = { 94 'builddir': build_dir, 95 'buildtype': [] 96 } 97 ctx.catalogue[build_dir]['buildtype'].append(buildtype) 89 98 return build_dir, output_node, output_dir, doctrees 90 99 … … 314 323 cmd_configure(ctx) 315 324 325 def xml_catalogue(ctx): 326 # 327 # Read the conf.py files in each directory to gather the doc details. 328 # 329 sp = sys.path[:] 330 for t in ctx.cur_tasks: 331 if t.get_cwd().is_src(): 332 doc = os.path.basename(t.get_cwd().get_src().abspath()) 333 sys.path.insert(0, str(t.get_cwd())) 334 # 335 # Import using the imp API so the module is reloaded for us. 336 # 337 import imp 338 mf = imp.find_module('conf') 339 try: 340 bconf = imp.load_module('bconf', mf[0], mf[1], mf[2]) 341 finally: 342 mf[0].close() 343 sys.path = sp[:] 344 if doc in ctx.catalogue: 345 ctx.catalogue[doc]['title'] = bconf.project 346 ctx.catalogue[doc]['version'] = bconf.version 347 ctx.catalogue[doc]['release'] = bconf.release 348 ctx.catalogue[doc]['latex'] = bconf.latex_documents[0][1] 349 bconf = None 350 351 import xml.dom.minidom as xml 352 cat = xml.Document() 353 354 root = cat.createElement('rtems-docs') 355 root.setAttribute('date', 'today') 356 cat.appendChild(root) 357 358 for d in ctx.catalogue: 359 doc = cat.createElement('doc') 360 name = cat.createElement('name') 361 text = cat.createTextNode(d) 362 name.appendChild(text) 363 title = cat.createElement('title') 364 text = cat.createTextNode(ctx.catalogue[d]['title']) 365 title.appendChild(text) 366 release = cat.createElement('release') 367 text = cat.createTextNode(ctx.catalogue[d]['release']) 368 release.appendChild(text) 369 version = cat.createElement('version') 370 text = cat.createTextNode(ctx.catalogue[d]['version']) 371 version.appendChild(text) 372 doc.appendChild(name) 373 doc.appendChild(title) 374 doc.appendChild(release) 375 doc.appendChild(version) 376 for b in ctx.catalogue[d]['buildtype']: 377 if b == 'latex': 378 b = 'pdf' 379 ref = ctx.catalogue[d]['latex'].replace('.tex', '.pdf') 380 elif b == 'html': 381 ref = '%s/index.html' % (d) 382 else: 383 ref = 'undefined' 384 output = cat.createElement(b) 385 text = cat.createTextNode(ref) 386 output.appendChild(text) 387 doc.appendChild(output) 388 root.appendChild(doc) 389 390 catnode = ctx.path.get_bld().make_node('catalogue.xml') 391 catnode.write(cat.toprettyxml(indent = ' ' * 2, newl = os.linesep)) 392 393 cat.unlink() 316 394 317 395 CONF_FRAG = """ -
wscript
r2c5cfad r916d295 31 31 conf.env['BUILD_FROM_TOP'] = 'yes' 32 32 33 def xml_catalogue(ctx): 34 docs_waf.xml_catalogue(ctx) 35 33 36 def build(ctx): 37 ctx.catalogue = {} 38 ctx.add_post_fun(xml_catalogue) 34 39 for b in building: 35 40 ctx.recurse(b) 41 ctx.install_files('${PREFIX}', 'catalogue.xml') 36 42 37 43 def install(ctx):
Note: See TracChangeset
for help on using the changeset viewer.