From 35bb8304ab99bde2623b9b64b80728d31fbee14f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 23 Oct 2018 10:39:22 +0000 Subject: [FIX] doc: building on Python 3.6.7, 3.7.1, possibly 2.7.??? https://bugs.python.org/issue33899 tokenize.generate_tokens was altered to match the C tokenizer, previously it would end the tokenization with just an ENDMARKER, in the titled releases it adds a NEWLINE before the ENDMARKER if none is present, this broke the parsing of jsdoc type specifications as Python's tokenizer is used under the cover. closes odoo/odoo#28056 --- doc/_extensions/autojsdoc/parser/types.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/_extensions') diff --git a/doc/_extensions/autojsdoc/parser/types.py b/doc/_extensions/autojsdoc/parser/types.py index 8737b26ecc9..69836f46ac4 100644 --- a/doc/_extensions/autojsdoc/parser/types.py +++ b/doc/_extensions/autojsdoc/parser/types.py @@ -44,6 +44,8 @@ def tokenize(typespec): yield (LITERAL, ast.literal_eval(string)) elif toktype == token.ENDMARKER: return + elif toktype == token.NEWLINE: + pass else: raise ValueError("Unknown typespec token %s" % token.tok_name[toktype]) -- cgit v1.2.3 From 27cc2ae3a91ad7a2fb16923256a359406e8bd68c Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 23 Oct 2018 15:53:50 +0200 Subject: [FIX] doc: backport of 9a07a4599ce to 10.0 To be compatible with sphinx >= 1.6 --- doc/_extensions/odoo_ext/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'doc/_extensions') diff --git a/doc/_extensions/odoo_ext/__init__.py b/doc/_extensions/odoo_ext/__init__.py index 0ec55620497..c1637623e62 100644 --- a/doc/_extensions/odoo_ext/__init__.py +++ b/doc/_extensions/odoo_ext/__init__.py @@ -8,10 +8,13 @@ import sphinx.environment import sphinx.builders.html from docutils import nodes def setup(app): - if getattr(app.config, 'html_translator_class', None): - app.warn("Overriding the explicitly set html_translator_class setting", - location="odoo extension") - app.config.html_translator_class = 'odoo_ext.translator.BootstrapTranslator' + if hasattr(app, 'set_translator'): + app.set_translator('html', translator.BootstrapTranslator) + else: + if getattr(app.config, 'html_translator_class', None): + app.warn("Overriding the explicitly set html_translator_class setting", + location="odoo extension") + app.config.html_translator_class = 'odoo_ext.translator.BootstrapTranslator' switcher.setup(app) app.add_config_value('odoo_cover_default', None, 'env') -- cgit v1.2.3 From a0050c323cbbd43de016978406f7832b18ade161 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 23 Oct 2018 15:56:58 +0200 Subject: [FIX] doc: backport of ac37ca39eaf to 10.0 To be compatible with sphinx >= 1.8 --- doc/_extensions/github_link.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'doc/_extensions') diff --git a/doc/_extensions/github_link.py b/doc/_extensions/github_link.py index cd0c5380621..b09177cf6e2 100644 --- a/doc/_extensions/github_link.py +++ b/doc/_extensions/github_link.py @@ -94,11 +94,12 @@ def add_doc_link(app, pagename, templatename, context, doctree): if not app.config.github_user and app.config.github_project: return - # FIXME: find other way to recover current document's source suffix - # in Sphinx 1.3 it's possible to have mutliple source suffixes and that - # may be useful in the future source_suffix = app.config.source_suffix - source_suffix = source_suffix if isinstance(source_suffix, basestring) else source_suffix[0] + # in 1.3 source_suffix can be a list + # in 1.8 source_suffix can be a mapping + # FIXME: will break if we ever add support for !rst markdown documents maybe + if not isinstance(source_suffix, basestring): + source_suffix = next(iter(source_suffix)) # can't use functools.partial because 3rd positional is line not mode context['github_link'] = lambda mode='edit': make_github_link( app, 'doc/%s%s' % (pagename, source_suffix), mode=mode) -- cgit v1.2.3 From 71cb425d0004fe6aff283b5ddfef704f167f88db Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Thu, 25 Oct 2018 11:08:35 +0200 Subject: [FIX] doc: translator under Sphinx 1.5 In Sphinx 1.5 (fairly specifically), the warner thing takes a `type` kw, and building the doc blows up if that parameter is not provided. --- doc/_extensions/odoo_ext/translator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/_extensions') diff --git a/doc/_extensions/odoo_ext/translator.py b/doc/_extensions/odoo_ext/translator.py index 48c5e901f28..f466b9ad6d0 100644 --- a/doc/_extensions/odoo_ext/translator.py +++ b/doc/_extensions/odoo_ext/translator.py @@ -196,7 +196,7 @@ class BootstrapTranslator(nodes.NodeVisitor, object): else: opts = {} - def warner(msg): + def warner(msg, **kw): self.builder.warn(msg, (self.builder.current_docname, node.line)) highlighted = self.builder.highlighter.highlight_block( node.rawsource, lang, opts=opts, warn=warner, linenos=linenos, -- cgit v1.2.3