root / pycommunity / pycommunity / doc / package.txt

Revision 78:b5dabe9762d1, 1.8 kB (checked in by Tarek Ziad?? <tarek@…>, 21 months ago)

rupy slides, starting up

Line 
1=======
2package
3=======
4
5package provides a `PackageTask` class that is used to generate documentation
6for packages. It scans each package folder and uses several page templates
7to generate html pages:
8
9- `packageindex`: a template for the index page
10
11- `packagedoc`: a template for each reST file founded in the folder
12
13- `packagestats`: a page that gathers stats about the package
14
15
16Let's create a fake conf::
17
18    >>> class Conf(object):
19    ...     targets = {'target1': 'tests/www'}
20    ...     glossary = 'tests/svn/project/doc/glossary.txt'
21    ...     tutorials = {'recipes': 'tests/svn/project/tutorials'}   
22    ...     recipes = {'recipes': 'tests/svn/project/recipes'}   
23    ...     packages = {'package1': 'tests/svn/project/src/package1',
24    ...                 'package2': 'tests/svn/project/src/package2' }
25    ...     options = {'projectname': 'PyCommunity',
26    ...                 'packages': 'tests/svn/project/doc/packages.txt'}
27    ...     templates = {'packageindex': 'tests/templates/packageindex.pt',
28    ...                  'packagesindex': 'tests/templates/packagesindex.pt',
29    ...                  'packagestats': 'tests/templates/packagestats.pt',
30    ...                  'packagedoc': 'tests/templates/packagedoc.pt'}
31    ...
32
33Let's run the package creator::
34   
35    >>> from package import PackageTask
36    >>> task = PackageTask()
37    >>> task._run(Conf())
38
39What is the result ?::
40
41    >>> import os
42    >>> os.path.exists('tests/www/packages/package1')
43    True
44    >>> os.path.exists('tests/www/packages/package1/README.html')
45    True
46    >>> os.path.exists('tests/www/packages/package1/epydoc/index.html')
47    True
48    >>> the_doc = open('tests/www/packages/package1/thedoc.html')
49    >>> print the_doc.read()
50    <html>
51    ...
52    <p>You know, package 1 is cool.</p>
53    ...
54    </html>
Note: See TracBrowser for help on using the browser.