Re: [BuildStream] [Proposal] Plugin fragmentation / Treating Plugins as Sources



On Mon, 2019-04-15 at 10:16 +0100, Adam Coldrick via buildstream-list
wrote:
<snip>
You can override the default import mechanism to allow this, by using
`imp` or similar to pre-create a module for each version of a library
(with a versioned name) and then automatically rewriting import names
to make them return the correct version of the imported module.

An example implementation of this is [0]. That is broken in Python 3,
but can be fixed with a simple s/__builtin__/builtins/.

I forgot to mention here that you also need to modify line 120 of
multiversion.py to do `version.encode()` rather than passing the string
straight to `binascii.hexlify`.

Adam



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]