Changeset 782b4fe in rtems-docs
- Timestamp:
- 01/09/17 23:11:05 (6 years ago)
- Branches:
- 5, am, master
- Children:
- 9aa52b9
- Parents:
- 1a9b02e
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/waf.py
r1a9b02e r782b4fe 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 catalogue91 #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)98 89 return build_dir, output_node, output_dir, doctrees 99 90 … … 323 314 cmd_configure(ctx) 324 315 325 def xml_catalogue(ctx): 316 def xml_catalogue(ctx, building): 317 # 318 # The following is a hack to find the top_dir because the task does 319 # provided a reference to top_dir like a build context. 320 # 321 top_dir = ctx.get_cwd().find_node('..') 326 322 # 327 323 # Read the conf.py files in each directory to gather the doc details. 328 324 # 325 catalogue = {} 329 326 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 327 for doc in building: 328 sys.path.insert(0, top_dir.find_node(doc).abspath()) 329 # 330 # Import using the imp API so the module is reloaded for us. 331 # 332 import imp 333 mf = imp.find_module('conf') 334 try: 335 bconf = imp.load_module('bconf', mf[0], mf[1], mf[2]) 336 finally: 337 mf[0].close() 338 sys.path = sp[:] 339 catalogue[doc] = { 340 'title': bconf.project, 341 'version': bconf.version, 342 'release': bconf.release, 343 'pdf': bconf.latex_documents[0][1].replace('.tex', '.pdf'), 344 'html': '%s/index.html' % (doc), 345 'singlehtml': '%s.html' % (doc) 346 } 347 bconf = None 350 348 351 349 import xml.dom.minidom as xml … … 356 354 cat.appendChild(root) 357 355 358 for d in ctx.catalogue: 356 builds = ['html'] 357 if ctx.env.BUILD_PDF == 'yes': 358 builds += ['pdf'] 359 if ctx.env.BUILD_SINGLEHTML == 'yes': 360 builds += ['singlehtml'] 361 362 for d in building: 359 363 doc = cat.createElement('doc') 360 364 name = cat.createElement('name') … … 362 366 name.appendChild(text) 363 367 title = cat.createElement('title') 364 text = cat.createTextNode(c tx.catalogue[d]['title'])368 text = cat.createTextNode(catalogue[d]['title']) 365 369 title.appendChild(text) 366 370 release = cat.createElement('release') 367 text = cat.createTextNode(c tx.catalogue[d]['release'])371 text = cat.createTextNode(catalogue[d]['release']) 368 372 release.appendChild(text) 369 373 version = cat.createElement('version') 370 text = cat.createTextNode(c tx.catalogue[d]['version'])374 text = cat.createTextNode(catalogue[d]['version']) 371 375 version.appendChild(text) 372 376 doc.appendChild(name) … … 374 378 doc.appendChild(release) 375 379 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' 380 for b in builds: 384 381 output = cat.createElement(b) 385 text = cat.createTextNode( ref)382 text = cat.createTextNode(catalogue[d][b]) 386 383 output.appendChild(text) 387 384 doc.appendChild(output) 388 385 root.appendChild(doc) 389 386 390 catnode = ctx. path.get_bld().make_node('catalogue.xml')387 catnode = ctx.get_cwd().make_node('catalogue.xml') 391 388 catnode.write(cat.toprettyxml(indent = ' ' * 2, newl = os.linesep)) 392 389 -
wscript
r1a9b02e r782b4fe 7 7 path.append(abspath('common')) 8 8 9 import waflib 9 10 import waf as docs_waf 10 11 … … 31 32 conf.env['BUILD_FROM_TOP'] = 'yes' 32 33 33 def xml_catalogue(ctx):34 docs_waf.xml_catalogue(ctx )34 def catalogue(ctx): 35 docs_waf.xml_catalogue(ctx, building) 35 36 36 37 def build(ctx): 37 ctx.catalogue = {}38 ctx.add_post_fun(xml_catalogue)39 38 for b in building: 40 39 ctx.recurse(b) 41 ctx.install_files('${PREFIX}', 'catalogue.xml') 40 ctx(rule = catalogue, 41 target = 'catalogue.xml', 42 source = ['wscript', 'common/waf.py']) 42 43 43 44 def install(ctx):
Note: See TracChangeset
for help on using the changeset viewer.