From 9477ce4b88ea44883bd7d70dc404cf5b9c705a53 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Mon, 27 Jun 2022 10:40:47 +0100 Subject: [PATCH 1/3] exekall.engine: Fix FrozenExprVal.callable_ property FIX FrozenExprVal's callable_ is reloaded from a fully qualified name only. Since some part of exekall expect methods to be wrapped in UnboundMethod, detect the required cases and wrap the callable. --- tools/exekall/exekall/engine.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/exekall/exekall/engine.py b/tools/exekall/exekall/engine.py index cc0733c79..cfd893bf9 100644 --- a/tools/exekall/exekall/engine.py +++ b/tools/exekall/exekall/engine.py @@ -3696,9 +3696,24 @@ class FrozenExprVal(ExprValBase): return AttributeError(f'Producer of {self} not found') qualname = self.callable_qualname[len(mod_name):].lstrip('.') + qualname = qualname.split('.') attr = mod - for name in qualname.split('.'): - attr = getattr(attr, name) + attr_path = list(functools.accumulate(getattr)) + + if ( + len(attr_path) > 1 and + isinstance( + attr, + ( + # Instance and static methods + types.FunctionType, + # Class methods + types.MethodType, + ) + ) + ): + attr = UnboundMethod(attr, attr_path[-2]) + return attr @property -- GitLab From 2949b9493a28e6c18e37fd73605dbf6708ae2a33 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Mon, 27 Jun 2022 11:13:44 +0100 Subject: [PATCH 2/3] doc: Set Sphinx language FIX Silence Sphinx warning and explicitly set English. --- doc/conf.py | 2 +- lisa/_doc/manconf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 92cda36ff..df4130764 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -145,7 +145,7 @@ release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +language = 'en' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/lisa/_doc/manconf.py b/lisa/_doc/manconf.py index 2c7c513f7..a79b7b01b 100644 --- a/lisa/_doc/manconf.py +++ b/lisa/_doc/manconf.py @@ -55,7 +55,7 @@ master_doc = 'man' # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -- GitLab From 95c653ea4ce9207d83a952e575d89aa405372457 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Mon, 27 Jun 2022 11:30:52 +0100 Subject: [PATCH 3/3] lisa._doc.helpers: Escape changelog entries FIX Escape the changelog entries so that it will not trip Sphinx if it recognizes invalid reStructuredText in it. --- lisa/_doc/helpers.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisa/_doc/helpers.py b/lisa/_doc/helpers.py index 7af72e44c..3356cbb62 100644 --- a/lisa/_doc/helpers.py +++ b/lisa/_doc/helpers.py @@ -701,8 +701,8 @@ def make_changelog(repo): return f'{title}\n{body}' def format_msg(msg): - subject = msg.splitlines()[0] - return f'- {subject.strip()}' + subject = escape(msg.splitlines()[0].strip()) + return f'- {subject}' rst = '\n\n'.join( format_release(name, sections) @@ -719,4 +719,13 @@ class PlaceHolderRef: documentable. """ +def escape(s): + """ + Escape the string so that it's considered plain reStructuredText input, + without any markup even if it contains some. This avoids having to use a + literal block that is displayed differently. + """ + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#escaping-mechanism + return re.sub(r'(?=[^\s])([^\\])', r'\\\1', s) + # vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 -- GitLab