Unverified Commit 31a8d9e2 authored by Anton Joubert's avatar Anton Joubert
Browse files

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.
parent 2203f494
Loading
Loading
Loading
Loading
+9 −1
Changes for doc/how-to-contribute.rst: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -30,9 +30,17 @@ It also uses autodoc_ importing docstrings from tango package.
Theme is not important, a theme prepared for Tango Community can be also used.

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

To test the docs locally in a Sphinx Docker container:
      - ``(host) $ cd /path/to/pytango``
      - ``(host) $ docker run --rm -ti -v $PWD:/docs sphinxdoc/sphinx bash``
      - ``(container) $ python -m pip install six numpy sphinx_rtd_theme``
      - ``(container) $ python -m sphinx doc build/sphinx``

After building, open the ``build/doc/index.html`` page in your browser.

Source code standard
--------------------

+16 −0
Changes for doc/mock_tango_extension.py: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -115,12 +115,28 @@ def set_device_proxy_implementations(module):
    module.DeviceProxy = type('DeviceProxy', (module.Connection,), attrs)


# Create ExtractAs with dummy "methods"
def set_extract_as_implementation(module):
    attrs= {
        '__module__': module.__name__,
        'ByteArray': None,
        'Bytes': None,
        'List': None,
        'Nothing': None,
        'Numpy': None,
        'String': None,
        'Tuple': None,
    }
    module.ExtractAs = type('ExtractAs', (object,), attrs)


# Patch the extension module
_tango = ExtensionMock(name='_tango')
_tango.constants.TgLibVers = TANGO_VERSION
_tango._get_tango_lib_release.return_value = TANGO_VERSION_INT
set_device_implementations(_tango)
set_device_proxy_implementations(_tango)
set_extract_as_implementation(_tango)


# Patch modules