Building the documentation on Debian unstable with Python 3.7 fails:
```
debian-unstable$ HTML_THEME=saltstack make -C doc html
make: Entering directory 'doc'
No need to update translations. Skipping...
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.7.9
loading translations [en]... done
Exception occurred:
File "/usr/lib/python3/dist-packages/sphinx/util/jsonimpl.py", line 22, in <module>
class SphinxJSONEncoder(json.JSONEncoder):
TypeError: __mro_entries__ must return a tuple
The full traceback has been saved in /tmp/sphinx-err-wzl9_n0k.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make: *** [Makefile:72: html] Error 2
make: Leaving directory 'doc'
debian-unstable$ cat /tmp/sphinx-err-wzl9_n0k.log
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sphinx/cmdline.py", line 303, in main
args.warningiserror, args.tags, args.verbosity, args.jobs)
File "/usr/lib/python3/dist-packages/sphinx/application.py", line 187, in __init__
self.setup_extension(extension)
File "/usr/lib/python3/dist-packages/sphinx/application.py", line 411, in setup_extension
self.registry.load_extension(self, extname)
File "/usr/lib/python3/dist-packages/sphinx/registry.py", line 315, in load_extension
mod = __import__(extname, None, None, ['setup'])
File "/usr/lib/python3/dist-packages/sphinx/builders/applehelp.py", line 20, in <module>
from sphinx.builders.html import StandaloneHTMLBuilder
File "/usr/lib/python3/dist-packages/sphinx/builders/html.py", line 43, in <module>
from sphinx.util import jsonimpl, logging, status_iterator
File "/usr/lib/python3/dist-packages/sphinx/util/jsonimpl.py", line 22, in <module>
class SphinxJSONEncoder(json.JSONEncoder):
TypeError: __mro_entries__ must return a tuple
```
The json module is a standard module. I is always present. So do not mock it.
Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This is fix errors like the following when building docs:
WARNING: autodoc: failed to import module 'salt.states.saltmod'; the following exception was raised:
Traceback (most recent call last):
File "/public/src/salt/env/lib/python3.6/site-packages/sphinx/ext/autodoc/importer.py", line 140, in import_module
__import__(modname)
File "/public/src/salt/salt/states/saltmod.py", line 36, in <module>
import salt.output
File "/public/src/salt/salt/output/__init__.py", line 19, in <module>
import salt.loader
File "/public/src/salt/salt/loader.py", line 23, in <module>
import salt.config
File "/public/src/salt/salt/config/__init__.py", line 27, in <module>
import salt.utils.network
File "/public/src/salt/salt/utils/network.py", line 35, in <module>
import salt.utils.zeromq
File "/public/src/salt/salt/utils/zeromq.py", line 39, in <module>
if tornado.version_info < (5,):
TypeError: '<' not supported between instances of 'Mock' and 'tuple'
(cherry picked from commit 8199700fdb)
Due to the many merge conflicts created from #47106 against the 2017.7 branch
and #46002 against the 2018.3 branch, the changes from #47106 have been largely
removed from this merge forward and the HEAD of 2018.3 was taken.
A separate fix for Tornado 5.0 support will need to be made directly against the
2018.3 branch.
Conflicts:
- doc/topics/development/conventions/formulas.rst
- salt/master.py
- salt/minion.py
- salt/netapi/rest_tornado/saltnado.py
- salt/states/zfs.py
- salt/transport/ipc.py
- salt/transport/tcp.py
- salt/transport/zeromq.py
- salt/utils/async.py
- tests/support/helpers.py
- tests/support/parser/cover.py
- tests/unit/grains/test_core.py
- tests/unit/modules/test_ssh.py
- tests/unit/test_minion.py
- tests/unit/utils/test_safe_walk.py
Debian uses the previous documentation theme. Make the documentation
theme configurable via an environment variable HTML_THEME.
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
Building the documentation with the Python 3 version of sphinx fails:
$ make -C doc html SPHINXBUILD=/usr/share/sphinx/scripts/python3/sphinx-build
[...]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sphinx/cmdline.py", line 296, in main
app.build(opts.force_all, filenames)
File "/usr/lib/python3/dist-packages/sphinx/application.py", line 333, in build
self.builder.build_update()
File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 251, in build_update
'out of date' % len(to_build))
File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 265, in build
self.doctreedir, self.app))
File "/usr/lib/python3/dist-packages/sphinx/environment/__init__.py", line 556, in update
self._read_serial(docnames, app)
File "/usr/lib/python3/dist-packages/sphinx/environment/__init__.py", line 576, in _read_serial
self.read_doc(docname, app)
File "/usr/lib/python3/dist-packages/sphinx/environment/__init__.py", line 684, in read_doc
pub.publish()
File "/usr/lib/python3/dist-packages/docutils/core.py", line 217, in publish
self.settings)
File "/usr/lib/python3/dist-packages/sphinx/io.py", line 55, in read
self.parse()
File "/usr/lib/python3/dist-packages/docutils/readers/__init__.py", line 78, in parse
self.parser.parse(self.input, document)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/__init__.py", line 191, in parse
self.statemachine.run(inputlines, document, inliner=self.inliner)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 172, in run
input_source=document['source'])
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 2989, in text
self.section(title.lstrip(), source, style, lineno + 1, messages)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 328, in section
self.new_subsection(title, lineno, messages)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 396, in new_subsection
node=section_node, match_titles=True)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 283, in nested_parse
node=node, match_titles=match_titles)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 197, in run
results = StateMachineWS.run(self, input_lines, input_offset)
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 2754, in underline
self.section(title, source, style, lineno - 1, messages)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 328, in section
self.new_subsection(title, lineno, messages)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 396, in new_subsection
node=section_node, match_titles=True)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 283, in nested_parse
node=node, match_titles=match_titles)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 197, in run
results = StateMachineWS.run(self, input_lines, input_offset)
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 2754, in underline
self.section(title, source, style, lineno - 1, messages)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 328, in section
self.new_subsection(title, lineno, messages)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 396, in new_subsection
node=section_node, match_titles=True)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 283, in nested_parse
node=node, match_titles=match_titles)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 197, in run
results = StateMachineWS.run(self, input_lines, input_offset)
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/usr/lib/python3/dist-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 2327, in explicit_markup
nodelist, blank_finish = self.explicit_construct(match)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 2339, in explicit_construct
return method(self, expmatch)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 2082, in directive
directive_class, match, type_name, option_presets)
File "/usr/lib/python3/dist-packages/docutils/parsers/rst/states.py", line 2131, in run_directive
result = directive_instance.run()
File "/usr/lib/python3/dist-packages/sphinx/ext/autodoc.py", line 1668, in run
documenter.generate(more_content=self.content)
File "/usr/lib/python3/dist-packages/sphinx/ext/autodoc.py", line 1013, in generate
self.document_members(all_members)
File "/usr/lib/python3/dist-packages/sphinx/ext/autodoc.py", line 1388, in document_members
ModuleLevelDocumenter.document_members(self, all_members)
File "/usr/lib/python3/dist-packages/sphinx/ext/autodoc.py", line 903, in document_members
for (mname, member, isattr) in self.filter_members(members, want_all):
File "/usr/lib/python3/dist-packages/sphinx/ext/autodoc.py", line 871, in filter_members
not keep, self.options)
File "/usr/lib/python3/dist-packages/sphinx/application.py", line 593, in emit_firstresult
for result in self.emit(event, *args):
File "/usr/lib/python3/dist-packages/sphinx/application.py", line 589, in emit
results.append(callback(self, *args))
File "/usr/lib/python3/dist-packages/sphinx/ext/napoleon/__init__.py", line 426, in _skip_member
cls_path, _, _ = qualname.rpartition('.')
ValueError: not enough values to unpack (expected 3, got 0)
The napoleon sphinx extensions queries the attribute __qualname__ of the
given obj and expect a string as result. It uses a default value if this
attribute does not exist. The real Python modules do not have a
__qualname__ attribute, but the doc.conf.Mock object returns a Mock
object when queried for the __qualname__ attribute. Change the Mock
object to raise an AttributeError instead. This fixes#45684.
When using Python 3 to generate the documentation, it will fail:
$ make -C doc html SPHINXBUILD=/usr/share/sphinx/scripts/python3/sphinx-build
[...]
File "salt/config/__init__.py", line 84, in _gather_buffer_space
if HAS_PSUTIL and psutil.version_info >= (0, 6, 0):
TypeError: '>=' not supported between instances of 'Mock' and 'tuple'
Therefore add fake version variables to the mocked msgpack and psutil
module.
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
The salt/sdb/keyring_db.py
Traceback (most recent call last):
File "salt/sdb/keyring_db.py", line 53, in <module>
import keyring
File "/usr/lib/python2.7/dist-packages/keyring/__init__.py", line 6, in <module>
from .core import (set_keyring, get_keyring, set_password, get_password,
File "/usr/lib/python2.7/dist-packages/keyring/core.py", line 148, in <module>
init_backend()
File "/usr/lib/python2.7/dist-packages/keyring/core.py", line 64, in init_backend
keyrings = filter(limit, backend.get_all_keyring())
File "/usr/lib/python2.7/dist-packages/keyring/util/__init__.py", line 20, in wrapper
func.always_returns = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/keyring/backend.py", line 191, in get_all_keyring
exceptions=TypeError))
File "/usr/lib/python2.7/dist-packages/keyring/util/__init__.py", line 29, in suppress_exceptions
for callable in callables:
File "/usr/lib/python2.7/dist-packages/keyring/backend.py", line 183, in is_class_viable
keyring_cls.priority
File "/usr/lib/python2.7/dist-packages/keyring/util/properties.py", line 22, in __get__
return self.fget.__get__(None, owner)()
File "/usr/lib/python2.7/dist-packages/keyring/backends/kwallet.py", line 128, in priority
return super(DBusKeyringKWallet4, cls).priority - 1
File "/usr/lib/python2.7/dist-packages/keyring/util/properties.py", line 22, in __get__
return self.fget.__get__(None, owner)()
File "/usr/lib/python2.7/dist-packages/keyring/backends/kwallet.py", line 31, in priority
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
NameError: global name 'DBusGMainLoop' is not defined
Therefore also mock the keyring module when generating the
documentation. This fixes#45072.
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
The changes to 2017.7 were merged forward accidentally, in a section
that should have it's own settings. This restores the setting variables
for the develop branch.