How do I “semi install” a plugin that is normally installed as an egg, using setup.py develop?

StackOverflow https://stackoverflow.com/questions/11228709

  •  17-06-2021
  •  | 
  •  

Pergunta

I am trying to debug a plugin issue with Trac and TracMercurial. The plugin does not quite work for me when packaged as an egg and deployed normally.

Using setup.py develop results in plugin not being visible. Using setup.py install works fine, but I can't debug the results, which I intend to do by adding some logging code to the plugin, so that when the module tries to load, I will be able to inspect the environment and see where it's failing.

I tried to do this command so I could possibly begin to debug the python code that is in the plugin to see where it fails, and why:

c:\workdir> python setup.py develop --exclude-scripts --install-dir "C:\...\python\Lib\site-packages" 

After doing this, there is an egg-link file in the site-packages directory, but Trac does not see the plugin. If however I use "setup.py install", and it copied the full .egg over to the site-packages directory, then Trac does see the plugin.

Clearly I'm not understanding "setup.py develop" mode. My goal is to get started with debugging a plugin that is not in any virtual-env, just a simple use of "setup.py develop".

Foi útil?

Solução

If setuptools or distribute is installed you can use the easy_install command with the -Z option to install the egg unzipped:

python setup.py easy_install -Z

so you can still edit the installed source code.

Outras dicas

I recommend the authoritative and rather exhaustive information for a Trac (plugin) development setup in trac.edgewall.org's wiki documentation. There you'll find all the required pieces and some options too. You may have missed the -md option to point to the plugin directory of that Trac environment, for what you want to make the plugin code available.

Have a look at TracDeveloperPlugin and Odd Simon Simons blog about Trac request profiling for more debugging options.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top