Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content

Resolve "incomplete patching of ophyd StatusBase"

guijar_m requested to merge 85-incomplete-patching-of-ophyd-statusbase into main

Description

ophyd __init__.py imports Status objects (directly, or indirectly via importing other sub-modules). Because of this, the naive patching introduced in !100 (merged) is not sufficient. Alas, patching this kind of class on a whole code base at runtime, with __init__.py interfering is not something easy, because of the way Python works.

So, this MR bites the bullet and introduces a custom import hook, to execute specific code when ophyd.status is imported - instead of letting Python handling module creation it creates itself a module, with code from the original ophyd.status + the patch to do to fix the unneeded threads problem (which is the root of all this).

This kind of black magic is not nice, but works 😁

The patch itself is the same as previously, with same result as code that has been merged in Ophyd ; but it works differently, it uses mocked threading.Thread (to minimize changes). The best solution would be to rely on a newer Ophyd.

Closes #85 (closed)

Merge request reports

Loading