Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit 31a8d9e

Browse files
committed
Fix doc build issue with ExtractAs
RTD build was failing due to problems with the `ExtractAs` class. Now mocking it. Possibly a newer version of Sphinx has pointed out this old problem. Added a note on how to do a local doc build using a Docker container.
1 parent 2203f49 commit 31a8d9e

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

doc/how-to-contribute.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ It also uses autodoc_ importing docstrings from tango package.
3030
Theme is not important, a theme prepared for Tango Community can be also used.
3131

3232
To test the docs locally requires Python >= 3.5:
33-
- ``$ pip install sphinx sphinx_rtd_theme``
33+
- ``$ python -m pip install sphinx sphinx_rtd_theme``
3434
- ``$ python setup.py build_doc``
3535

36+
To test the docs locally in a Sphinx Docker container:
37+
- ``(host) $ cd /path/to/pytango``
38+
- ``(host) $ docker run --rm -ti -v $PWD:/docs sphinxdoc/sphinx bash``
39+
- ``(container) $ python -m pip install six numpy sphinx_rtd_theme``
40+
- ``(container) $ python -m sphinx doc build/sphinx``
41+
42+
After building, open the ``build/doc/index.html`` page in your browser.
43+
3644
Source code standard
3745
--------------------
3846

doc/mock_tango_extension.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,28 @@ def set_device_proxy_implementations(module):
115115
module.DeviceProxy = type('DeviceProxy', (module.Connection,), attrs)
116116

117117

118+
# Create ExtractAs with dummy "methods"
119+
def set_extract_as_implementation(module):
120+
attrs= {
121+
'__module__': module.__name__,
122+
'ByteArray': None,
123+
'Bytes': None,
124+
'List': None,
125+
'Nothing': None,
126+
'Numpy': None,
127+
'String': None,
128+
'Tuple': None,
129+
}
130+
module.ExtractAs = type('ExtractAs', (object,), attrs)
131+
132+
118133
# Patch the extension module
119134
_tango = ExtensionMock(name='_tango')
120135
_tango.constants.TgLibVers = TANGO_VERSION
121136
_tango._get_tango_lib_release.return_value = TANGO_VERSION_INT
122137
set_device_implementations(_tango)
123138
set_device_proxy_implementations(_tango)
139+
set_extract_as_implementation(_tango)
124140

125141

126142
# Patch modules

0 commit comments

Comments
 (0)