docs: Fix the monkeypatching of blockdiag

blockdiag has a longstanding bug whereby it tries to access an attribute
on an 'io.BufferedReader' that doesn't exist. We had previously fixed
this in change Ibd32d30aacae65702d0ccbdb8a02b1667ec4e8ee, which undid
the damage blockdiag was doing. However, this worked because the monkey
patching blockdiag does happens when the 'blockdiag.utils.compat' module
is loaded [1], which was happening implicitly with our import of
'blockdiag.imagedraw.textfolder' [2]. However, that module no longer
imports the 'compat' [3] module so this doesn't work. Fix the issue by
just importing the 'compat' module manually, triggering the monkey
patching...which we can then undo.

[1] https://github.com/blockdiag/blockdiag/blob/2.0.0/src/blockdiag/utils/compat.py#L19-L26
[2] https://github.com/blockdiag/blockdiag/blob/1.5.4/src/blockdiag/imagedraw/textfolder.py#L18
[3] https://github.com/blockdiag/blockdiag/tree/2.0.0/src/blockdiag/imagedraw/textfolder.py

Change-Id: Idacfff98842fde38fb39791090f2da3310b441b5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2020-01-31 17:43:42 +00:00
parent c16315165c
commit 4bdecee385

View File

@ -197,6 +197,7 @@ def monkey_patch_blockdiag():
from codecs import getreader
from blockdiag.imagedraw import textfolder
from blockdiag.utils import compat # noqa
# oh, blockdiag. Let's undo the mess you made.
codecs.getreader = getreader