On Tuesday, March 27, 2012 8:05:04 PM UTC+2, Chris Nelson wrote: > > In http://groups.google.com/group/trac-dev/msg/828db3da4963ed9a?hl=en, I > got a good pointer to FullBlogPlugin as a model of how to have > conditional dependencies between plugins. I'm now trying to use that > and running into problems understanding what it all means.
Basically I have extracted the optional Blog features for TagsPlugin and SpamFilterPlugin into separate files, and added entry_point conditionals to only present them to Trac if they have no requirements, or have requirements that are met ('extras_require'). Your code looks to have caught the general idea of it, but your intra-code dependency explanation I cannot quite understand. So in essence; All code is installed, but pkg_resources will just present the 'entry_points' that are valid, so nothing in Trac will try to load your optional components so the code just sits there for a sunny day when requirements are met. > Also, I have Trac-jsGantt 0.10 installed but even if I make 'rescal' > > require 0.12, the resource calendar shows up in webadmin. How do I use > extras_require to only show the extra when the requirement is met? > > If there's a Python setup tutorial that covers this, I haven't found it > but would welcome a pointer. > Check out the setuptools documentation, it is likely the most relevant. Note that extras_require can be a list of requirements, so it can be 'rescal': ['Trac-jsGantt>=0.10', 'Trac>=0.12'] (or whatever suits your code structure). http://peak.telecommunity.com/DevCenter/setuptools#declaring-extras-optional-features-with-their-own-dependencies :::simon https://www.coderesort.com http://trac-hacks.org/wiki/osimons -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To view this discussion on the web visit https://groups.google.com/d/msg/trac-dev/-/uZa28b0_T00J. To post to this group, send email to trac-dev@googlegroups.com. To unsubscribe from this group, send email to trac-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en.