| Line | |
|---|
| 1 | #!/usr/bin/env python |
|---|
| 2 | # -*- coding: utf-8 -*- |
|---|
| 3 | """ |
|---|
| 4 | Build the Documentation |
|---|
| 5 | ~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 6 | |
|---|
| 7 | This command builds the documentation for Zine or a plugin. |
|---|
| 8 | |
|---|
| 9 | :copyright: (c) 2010 by the Zine Team, see AUTHORS for more details. |
|---|
| 10 | :license: BSD, see LICENSE for more details. |
|---|
| 11 | """ |
|---|
| 12 | import sys |
|---|
| 13 | from os.path import isdir, join, dirname, pardir, abspath |
|---|
| 14 | from optparse import OptionParser |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | sys.path.append(dirname(__file__)) |
|---|
| 18 | import _init_zine |
|---|
| 19 | from zine.docs.builder import walk |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | def main(): |
|---|
| 23 | parser = OptionParser(usage='%prog [options] [path]') |
|---|
| 24 | options, args = parser.parse_args() |
|---|
| 25 | if not args: |
|---|
| 26 | path = join(dirname(__file__), pardir, 'zine', 'docs') |
|---|
| 27 | elif len(args) == 1: |
|---|
| 28 | path = join(args[0], 'docs') |
|---|
| 29 | if not isdir(path): |
|---|
| 30 | parser.error('source folder missing') |
|---|
| 31 | else: |
|---|
| 32 | parser.error('incorrect number of arguments') |
|---|
| 33 | path = abspath(path) |
|---|
| 34 | print 'Building docs from', path |
|---|
| 35 | |
|---|
| 36 | def callback(filename): |
|---|
| 37 | print filename |
|---|
| 38 | walk(path, callback) |
|---|
| 39 | print 'All done.' |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | if __name__ == '__main__': |
|---|
| 43 | main() |
|---|
Note: See
TracBrowser
for help on using the repository browser.