ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since aa639ea was
9f68f7c,
checked in by Mathieu Doucet <doucetm@…>, 11 years ago
|
New and improved sphinx docs generation
|
-
Property mode set to
100644
|
File size:
1.9 KB
|
Line | |
---|
1 | import os |
---|
2 | |
---|
3 | MODULE_TEMPLATE=""" |
---|
4 | |
---|
5 | ****************************************************************************** |
---|
6 | %(name)s |
---|
7 | ****************************************************************************** |
---|
8 | |
---|
9 | :mod:`%(package)s.%(module)s` |
---|
10 | ============================================================================== |
---|
11 | |
---|
12 | .. automodule:: %(package)s.%(module)s |
---|
13 | :members: |
---|
14 | :undoc-members: |
---|
15 | :inherited-members: |
---|
16 | :show-inheritance: |
---|
17 | |
---|
18 | """ |
---|
19 | |
---|
20 | INDEX_TEMPLATE=""" |
---|
21 | |
---|
22 | .. _api-index: |
---|
23 | |
---|
24 | ############################################################################## |
---|
25 | %(package_name)s |
---|
26 | ############################################################################## |
---|
27 | |
---|
28 | .. only:: html |
---|
29 | |
---|
30 | :Release: |version| |
---|
31 | :Date: |today| |
---|
32 | |
---|
33 | .. toctree:: |
---|
34 | |
---|
35 | %(rsts)s |
---|
36 | """ |
---|
37 | |
---|
38 | SRC_DIR = 'source/api' |
---|
39 | |
---|
40 | for root, dirs, files in os.walk('../../src'): |
---|
41 | if '__init__.py' not in files: |
---|
42 | continue |
---|
43 | |
---|
44 | if not os.path.isdir(SRC_DIR): |
---|
45 | os.mkdir(SRC_DIR) |
---|
46 | |
---|
47 | module_path = root.replace('../../src/','') |
---|
48 | package = module_path.replace('/','.') |
---|
49 | |
---|
50 | if package.startswith('sans.simulation'): |
---|
51 | continue |
---|
52 | |
---|
53 | print package |
---|
54 | |
---|
55 | if not os.path.isdir('%s/%s' % (SRC_DIR, module_path)): |
---|
56 | os.mkdir('%s/%s' % (SRC_DIR, module_path)) |
---|
57 | rsts = "\n ".join(dirs) |
---|
58 | with open('%s/%s/index.rst' % (SRC_DIR, module_path), 'w') as f: |
---|
59 | f.write(INDEX_TEMPLATE % {'package_name': package, |
---|
60 | 'rsts': rsts}) |
---|
61 | f.close() |
---|
62 | |
---|
63 | for item in files: |
---|
64 | if not item.endswith('.py'): |
---|
65 | continue |
---|
66 | |
---|
67 | module, ext = os.path.splitext(item) |
---|
68 | with open('%s/%s/%s.rst' % (SRC_DIR, module_path, module), 'w') as f: |
---|
69 | f.write(MODULE_TEMPLATE % {'name': module, |
---|
70 | 'package': package, |
---|
71 | 'module': module}) |
---|
72 | f.close() |
---|
73 | |
---|
74 | #TODO: Need index for each module |
---|
Note: See
TracBrowser
for help on using the repository browser.