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
=== modified file 'docs/source/conf.py'
--- docs/source/conf.py 2012-08-20 11:33:46 +0000
+++ docs/source/conf.py 2012-09-03 09:53:24 +0000
@@ -19,21 +19,48 @@
19sys.path.insert(0, os.path.abspath('../..'))19sys.path.insert(0, os.path.abspath('../..'))
2020
2121
22class Mock(type):22class ModuleMock(object):
23 """23 """
24 Mock class to avoid import errors when building the documentation24 Mock class to avoid import errors when building the documentation in
25 in readthedocs.org25 readthedocs.org
26 """26 """
27 def __init__(self, name):
28 self.__name__ = name
29
27 def __getattr__(self, name):30 def __getattr__(self, name):
28 full_name = '{0}.{1}'.format(self.__name__, name)31 full_name = '{0}.{1}'.format(self.__name__, name)
29 cls = Mock(full_name, (type,), {})32
30 return cls33 # Submodules are returned if they exist
34 if full_name in sys.modules:
35 return sys.modules[full_name]
36
37 # Members that start with an upper case letter
38 # are expected to be a class
39 if name[0].isupper():
40 obj = ClassMock
41 # otherwise, the are assumed to be a function
42 else:
43 def function(*args, **kwargs):
44 pass
45 obj = function
46 obj.__name__ = full_name
47 return obj
48
49
50class ClassMock(object):
51 """
52 Mock class to avoid module member access errors when building the
53 documentation in readthedocs.org
54 """
55 def __init__(self, *args, **kwargs):
56 pass
57
3158
32# Mock all third party modules not available in the readthedocs.org environment59# Mock all third party modules not available in the readthedocs.org environment
33for mod_name in ('psutil', 'yaml', 'paramiko', 'jsonschema', 'libvirt',60for mod_name in ('psutil', 'yaml', 'paramiko', 'jsonschema', 'libvirt',
34 'bzrlib', 'bzrlib.builtins', 'bzrlib.plugin', 'bzrlib.errors',61 'bzrlib', 'bzrlib.builtins', 'bzrlib.plugin', 'bzrlib.errors',
35 'apt', 'apt.cache'):62 'apt', 'apt.cache'):
36 sys.modules[mod_name] = Mock(mod_name, (type,), {})63 sys.modules[mod_name] = ModuleMock(mod_name)
3764
38# -- General configuration -----------------------------------------------------65# -- General configuration -----------------------------------------------------
3966
4067
=== modified file 'docs/source/reference.rst'
--- docs/source/reference.rst 2012-08-17 13:31:54 +0000
+++ docs/source/reference.rst 2012-09-03 09:53:24 +0000
@@ -90,9 +90,6 @@
9090
91.. automodule:: utah.provisioning.inventory91.. automodule:: utah.provisioning.inventory
9292
93.. automodule:: utah.provisioning.inventory.bootspeed
94 :members:
95
96.. automodule:: utah.provisioning.inventory.exceptions93.. automodule:: utah.provisioning.inventory.exceptions
97 :members:94 :members:
9895

Subscribers

People subscribed via source and target branches