updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / python-sphinx-contrib / setup.py
blobd09c5223ab6d4f227dbe8521181add388277835a
1 #!/usr/bin/env python2
2 # -*- coding: utf-8 -*-
4 import os
5 import os.path
6 import sys
7 import shutil
8 import glob
9 from subprocess import call
11 src = sys.argv[1] # srcdir
12 dst = sys.argv[2] # pkgdir
13 doc = sys.argv[3] # document path
15 no_doc_list = [] # show which extensions have no documentation
17 os.chdir(src)
18 for i in os.listdir('.'):
19 os.chdir(src)
20 if os.path.isdir(i):
21 os.chdir(i)
22 if os.path.isfile("setup.py"):
24 # Build module
25 command = ["python2", "setup.py", "install", "--root=" + dst]
26 call(command)
28 # Build Documentation
29 readmeList = glob.glob("README*")
30 readme = None
31 if len(readmeList) == 1:
32 readme = readmeList[0]
33 elif "README" in readmeList:
34 readme = "README"
35 if readme != None:
36 shutil.move(readme, os.path.join(doc, i + '.rst'))
37 else:
38 global no_doc_list
39 no_doc_list += [i]
41 # Build embedded documentations
42 # Should be update manually.
43 SPECDOC = {
44 "zopeext":
45 """
46 =============
47 autointerface
48 =============
50 Sphinx extension that adds an :dir:`autointerface` directive, which can be
51 used like autoclass to document zope interfaces. Interfaces are
52 intended to be very different beasts than regular python classes, and
53 as a result require customized access to documentation, signatures
54 etc.
56 `autointerface` directive
57 -----------------------
58 The :dir:`autointerface` directive has the same form and option as the
59 :dir:`autoclass` directive::
61 .. autointerface:: IClass
62 ...
64 .. seealso:: :mod:`sphinx.ext.autodoc`
66 .. note:: This extension also serves as a simple example of using the
67 new sphinx version 6.0 version :mod:`autodoc` refactoring. Mostly
68 this was straight forward, but I stumbled across a "gotcha":
70 The `objtype` attribute of the documenters needs to be unique.
71 Thus, for example, :attr:`InterfaceMethodDocumenter.objtype`
72 cannot be `'method'` because this would overwrite the entry in
73 :attr:`AutoDirective._registry` used to choose the correct
74 documenter.
75 """,
78 for i in SPECDOC:
79 if i in no_doc_list:
80 with open(os.path.join(doc, i + '.rst'), "w") as f:
81 f.write(SPECDOC[i])
82 no_doc_list.remove(i)
84 print no_doc_list