~drizzle-developers/ubuntu/natty/drizzle/natty

« back to all changes in this revision

Viewing changes to config/pandora-plugin

  • Committer: Monty Taylor
  • Date: 2010-09-26 20:42:38 UTC
  • mto: (1273.675.2 build)
  • mto: This revision was merged to the branch mainline in revision 1315.
  • Revision ID: mordred@inaugust.com-20100926204238-35xbedep753dsmc1
Added support to pandora for finding and including per-plugin documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
plugin_am_file=None
27
27
plugin_ac_file=None
 
28
plugin_doc_index=None
28
29
 
29
30
class ChangeProtectedFile(object):
30
31
 
191
192
 
192
193
  write_plugin_ac(plugin, plugin_ac_file)
193
194
  write_plugin_am(plugin, plugin_am_file)
 
195
  write_plugin_docs(plugin, plugin_doc_index)
194
196
  plugin['writing_status'] = 'done'
195
197
 
 
198
def write_plugin_docs(plugin, doc_index):
 
199
  if plugin['docs'] is not None and os.path.isdir("docs/plugins"):
 
200
    if not os.path.exists(os.path.join("docs/plugins",plugin["name"])):
 
201
      os.symlink(os.path.abspath(plugin["docs"]), os.path.join("docs/plugins",plugin["name"]))
 
202
    doc_index.write("""
 
203
   %(name)s""" % plugin)
 
204
 
196
205
def write_plugin_ac(plugin, plugin_ac):
197
206
  #
198
207
  # Write plugin config instructions into plugin.ac file.
351
360
    return ""
352
361
  return None
353
362
 
 
363
def find_docs(plugin_dir):
 
364
  if os.path.isfile(os.path.join(plugin_dir, "docs", "index.rst")):
 
365
    return os.path.join(plugin_dir, "docs")
 
366
 
354
367
def read_plugin_ini(plugin_dir):
355
368
    if plugin_dir == ".":
356
369
      plugin_name="**OUT-OF-TREE**"
420
433
        plugin['testsuite']=True
421
434
      else:
422
435
        plugin['testsuite']=False
 
436
    plugin['docs']= find_docs(plugin_dir)
423
437
 
424
438
    plugin['cflags']+= ' ' + config['extra_cflags']
425
439
    plugin['cppflags']+= ' ' + config['extra_cppflags']
600
614
             accumulate_plugins,
601
615
             plugin_list)
602
616
 
603
 
 
604
617
if not os.path.exists("config/pandora-plugin.am") or "write" in actions:
605
618
  plugin_am_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.am'))
606
619
  plugin_am_file.write("""
631
644
  plugin_ac_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.ac'))
632
645
  plugin_ac_file.write("dnl Generated file, run make to rebuild\n")
633
646
 
 
647
if os.path.exists("docs/plugins"):
 
648
  if not os.path.exists("docs/plugins/list.rst") or "write" in actions:
 
649
    plugin_doc_index = ChangeProtectedFile("docs/plugins/list.rst")
 
650
    plugin_doc_index.write("""
 
651
Plugin Documentation
 
652
====================
 
653
 
 
654
.. toctree::
 
655
   :maxdepth: 2
 
656
""")
 
657
 
634
658
 
635
659
if os.path.exists('plugin.ini'):
636
660
  # Are we in a plugin dir which wants to have a self-sufficient build system?
672
696
  plugin_am_file.close()
673
697
if plugin_ac_file is not None:
674
698
  plugin_ac_file.close()
 
699
if plugin_doc_index is not None:
 
700
  plugin_doc_index.close()