<div dir="ltr">I forgot that buildbot travis is already doing exactly what you described, but for steps:<div><br></div><div><a href="https://github.com/buildbot/buildbot_travis/blob/master/buildbot_travis/travisyml.py#L86">https://github.com/buildbot/buildbot_travis/blob/master/buildbot_travis/travisyml.py#L86</a><br></div><div><br></div><div>The magic of yaml is that you can build the python objects directly from the yaml.</div><div>Pierre</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Apr 30, 2017 at 9:57 AM Pierre Tardy <<a href="mailto:tardyp@gmail.com">tardyp@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Paulo,<div>The plugin modules are indeed not really modules, and you cannot really call getattr on it or patch it.</div><div><br></div><div>I could not find documentation on the inner working of the plugin loader, but there is always the source code.</div><div><br></div><div>the www service is loading dynamically the list of www plugins. You can get soe ideas there:</div><div><a href="https://github.com/buildbot/buildbot/blob/master/master/buildbot/www/service.py#L186" target="_blank">https://github.com/buildbot/buildbot/blob/master/master/buildbot/www/service.py#L186</a><br>and</div><div><a href="https://github.com/buildbot/buildbot/blob/master/master/buildbot/www/service.py#L270" target="_blank">https://github.com/buildbot/buildbot/blob/master/master/buildbot/www/service.py#L270</a><br></div></div><div dir="ltr"><div><br></div><div>Pierre</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 25, 2017 at 1:30 PM Paulo Matos <pmatos@linki.tools> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
Using bb0.9.6 here with Python3.<br>
All good, except when I try to do dynamic loading of schedulers. I think<br>
this might be an issue with Python instead of bb but my guess is that<br>
someone here might be able to help.<br>
<br>
If I do:<br>
<br>
from buildbot.plugins import *<br>
b = schedulers.SingleBranchScheduler(...)<br>
<br>
<br>
all is good _but_ imagine I have a string with 'SingleBranchScheduler'<br>
and want to create a SingleBranchScheduler.<br>
<br>
I tried:<br>
from buildbot.plugins import *<br>
import importlib<br>
<br>
m = importlib.import_module('schedulers')<br>
schedclass = getattr(m, 'SingleBranchScheduler')<br>
b = schedclass(...)<br>
<br>
This fails at the import_module time. My guess is that this is due to<br>
the tricks being playing by plugins/__init__.py to allow importing<br>
schedulers. However, I am not sure how to work around this.<br>
<br>
My goal is to be able to have a json interface to define schedulers in<br>
an easy way and read that in master.cfg. Then, of course, scheduler<br>
class names will come in as a string and I need to transform that into a<br>
class for instantiation.<br>
<br>
Kind regards,<br>
<br>
--<br>
Paulo Matos<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
<a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a><br>
</blockquote></div></blockquote></div>