Merge lp:~javier.collado/utah/documentation-fixes into lp:utah

Proposed by Javier Collado
Status: Merged
Approved by: Javier Collado
Approved revision: 670
Merged at revision: 669
Proposed branch: lp:~javier.collado/utah/documentation-fixes
Merge into: lp:utah
Diff against target: 73 lines (+35/-11)
2 files modified
docs/source/conf.py (+35/-8)
docs/source/reference.rst (+0/-3)
To merge this branch: bzr merge lp:~javier.collado/utah/documentation-fixes
Reviewer Review Type Date Requested Status
Javier Collado (community) Approve
Review via email: mp+122484@code.launchpad.net

Description of the change

Documentation build in readthedocs.org is reporting two errors:

- bootspeed module isn't found
- Type error when calling: yaml.add_representer

This branch removes bootspeeed from the documentation (the module is no longer part of the code) and fixes the type error with a better version of the mocking code for readthedocs.org

To post a comment you must log in.
Revision history for this message
Javier Collado (javier.collado) wrote :

Since this merge proposal is focused just on fixing the documentation build errors, I'm merging it right away. Anyway, if you have any comment, let me know and I can work on fixing any problem.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/source/conf.py'
2--- docs/source/conf.py 2012-08-20 11:33:46 +0000
3+++ docs/source/conf.py 2012-09-03 09:53:24 +0000
4@@ -19,21 +19,48 @@
5 sys.path.insert(0, os.path.abspath('../..'))
6
7
8-class Mock(type):
9- """
10- Mock class to avoid import errors when building the documentation
11- in readthedocs.org
12- """
13+class ModuleMock(object):
14+ """
15+ Mock class to avoid import errors when building the documentation in
16+ readthedocs.org
17+ """
18+ def __init__(self, name):
19+ self.__name__ = name
20+
21 def __getattr__(self, name):
22 full_name = '{0}.{1}'.format(self.__name__, name)
23- cls = Mock(full_name, (type,), {})
24- return cls
25+
26+ # Submodules are returned if they exist
27+ if full_name in sys.modules:
28+ return sys.modules[full_name]
29+
30+ # Members that start with an upper case letter
31+ # are expected to be a class
32+ if name[0].isupper():
33+ obj = ClassMock
34+ # otherwise, the are assumed to be a function
35+ else:
36+ def function(*args, **kwargs):
37+ pass
38+ obj = function
39+ obj.__name__ = full_name
40+ return obj
41+
42+
43+class ClassMock(object):
44+ """
45+ Mock class to avoid module member access errors when building the
46+ documentation in readthedocs.org
47+ """
48+ def __init__(self, *args, **kwargs):
49+ pass
50+
51
52 # Mock all third party modules not available in the readthedocs.org environment
53 for mod_name in ('psutil', 'yaml', 'paramiko', 'jsonschema', 'libvirt',
54 'bzrlib', 'bzrlib.builtins', 'bzrlib.plugin', 'bzrlib.errors',
55 'apt', 'apt.cache'):
56- sys.modules[mod_name] = Mock(mod_name, (type,), {})
57+ sys.modules[mod_name] = ModuleMock(mod_name)
58
59 # -- General configuration -----------------------------------------------------
60
61
62=== modified file 'docs/source/reference.rst'
63--- docs/source/reference.rst 2012-08-17 13:31:54 +0000
64+++ docs/source/reference.rst 2012-09-03 09:53:24 +0000
65@@ -90,9 +90,6 @@
66
67 .. automodule:: utah.provisioning.inventory
68
69-.. automodule:: utah.provisioning.inventory.bootspeed
70- :members:
71-
72 .. automodule:: utah.provisioning.inventory.exceptions
73 :members:
74

Subscribers

People subscribed via source and target branches