when a plugin is executed with circus, the code is run inside the plugin_env but we add the plugin_dir to PYTHONPATH (we can change this but this is the default configuration) and in some cases (not configured by default), we can also add app_dir to PYTHONPATH
when a plugin is executed through plugin_wrapper (cron, continuous integration...), we don't add plugin_dir or app_dir to PYTHONPATH
when a plugin is executed in an interactive way inside plugin_env, we don't add plugin_dir or app_dir to PYTHONPATH
We have to define a unique way to do all these things. The main entry points should be plugin_wrapper. We have to rewrite it to add some options. Then, plugin_env and _make_circus_conf should use it and not write a specific code.
[x] write a better plugin_wrapper with an option (true by default) to add current plugin dir to pythonpath and an option (false by default) to add an app dir to pythonpath
[x] change _make_circus_conf in mfdata, mfserv to use this new plugin_wrapper instead of custom code
[x] change plugin_env in mfext to use this new plugin_wrapper instead of custom code
And last:
[x] change layerapi2 behaviour in mfext to add lib to PYTHONPATH by default(reverted change because of build problems)
[x] add lib to PYTHONPATH by default in plugin_wrapper
To take an example with mfserv:
circus
, the code is run inside the plugin_env but we add the plugin_dir toPYTHONPATH
(we can change this but this is the default configuration) and in some cases (not configured by default), we can also add app_dir toPYTHONPATH
plugin_wrapper
(cron, continuous integration...), we don't add plugin_dir or app_dir toPYTHONPATH
plugin_env
, we don't add plugin_dir or app_dir toPYTHONPATH
We have to define a unique way to do all these things. The main entry points should be
plugin_wrapper
. We have to rewrite it to add some options. Then,plugin_env
and_make_circus_conf
should use it and not write a specific code.plugin_wrapper
with an option (true by default) to add current plugin dir to pythonpath and an option (false by default) to add an app dir to pythonpath_make_circus_conf
inmfdata
,mfserv
to use this newplugin_wrapper
instead of custom codeplugin_env
inmfext
to use this newplugin_wrapper
instead of custom codeAnd last:
[x] change(reverted change because of build problems)layerapi2
behaviour inmfext
to addlib
toPYTHONPATH
by defaultPYTHONPATH
by default inplugin_wrapper