Le dimanche 18 janvier 2009 à 23:05 +0100, guijemont - Guillaume Emont a
écrit :
> On 21:31 Sun 18 Jan     , Guillaume Desmottes wrote:
> > Le dimanche 18 janvier 2009 à 21:37 +0100, guijemont - Guillaume Emont a
> > écrit :
> > > On 17:05 Sun 18 Jan     , Guillaume Desmottes wrote:
> > > > Le dimanche 18 janvier 2009 à 12:38 +0000, Guillaume Desmottes a écrit :
> > > > > Le lundi 12 janvier 2009 à 11:51 +0100, Olivier Tilloy a écrit :
> > > > > > > - I use pyamf to query the remote server. IIRC, the policy about
> > > > > > > external dep is to ship them with the plugin bundle. Is that 
> > > > > > > still true?
> > > > > > > If it is, do you have any doc explaining how to do it?
> > > > > > 
> > > > > > Still true. There is no documentation on how to do this but for 
> > > > > > small
> > > > > > dependencies it should be fairly easy. You can have a look at how 
> > > > > > it's
> > > > > > done in the weather plugin with pymetar
> > > > > > (http://bazaar.launchpad.net/~osomon/elisa-plugin-weather/weather/revision/18)
> > > > > 
> > > > > 
> > > > > Dependency is not that trivial. Is it possible to just ship PyAMF egg
> > > > > (as the one created using "easy_install pyamf" instead of the whole
> > > > > source tree?
> > > > 
> > > > Finally I managed to import the dependency but I had to do this ugly
> > > > hack:
> > > > http://bazaar.launchpad.net/~cassidy/elisa-plugin-rtbf/trunk/revision/30
> > > > 
> > > > Is that ok?
> > > I've heard it's unwise to use .__file__. You should rather use stuff
> > > like pkg_resources.resource_filename() I guess.
> > 
> > I changed my code to use it, thanks.
> > http://bazaar.launchpad.net/~cassidy/elisa-plugin-rtbf/trunk/revision/32
> > 
> > 
> > > Though I am not sure to
> > > understand the context around your code. Is pyamf in the egg of your
> > > plugin? Is it in another egg?
> > 
> > pyamf is shipped in the same egg as my plugin (I copied the structure of
> > the weather plugin). See 
> > http://bazaar.launchpad.net/%
> > 7Ecassidy/elisa-plugin-rtbf/trunk/files/head%3A/elisa/plugins/rtbf/
> > 
> > > If it's in the same egg, and the egg is
> > > built correctly, it should be possible to do the "import pyamf" without
> > > doing anything. That would require putting the pyamf directory at the root
> > > of your egg, and might conflict with other plugins (as well as your
> > > present solutoin),
> > 
> > That could work (didn't test) but I don't like this solution because I
> > don't think external deps should be present as the root of the egg.
> > 
> > > else, you might be able to import it as
> > > elisa.plugins.rtbf.extern.pyamf, not sure this works, but it looks to me
> > > like the safest solution.
> > 
> > This doesn't work because in pyamf's internal files, they use "import
> > pyamf", so my hack.
> 
> Damnit. That's a shame, because modifying the path like that and relying
> on it has a few drawbacks, if your code, or some other code in another
> plugin requires a specific version of pyamf: which one will get imported
> among one that's installed on the system, the one in your egg, and the
> one in another plugin that does the same thing?

Yeah I know that sucks. I guess that's what we get from shipping
external dep with plugin's egg...


> I think this kinda calls for some thinking, and possibly a
> dependency/versionning system. Sounds like a lot of work though.

I agree, we should really consider to have a better dependency system in
Elisa. I don't want to block next releases of my plugin on that though,
so we'll have to stick with the less crappy solution for now.

> Also, I think you should resource_filename on
> ('elisa.plugins.rtbf.extern', 'pyamf') or ('elisa.plugins.rtbf.pyamf',
> ''), don't know what works best/is cleaner. Else I don't think you can
> be guaranteed that pyamf files are indeed unzipped in the directory
> where extern is.

These don't work as I have to add the path containing the "pyafm"
directory.


        G.

-- 
Guillaume Desmottes <[email protected]>
Jabber <[email protected]>
GPG 1024D/711E31B1 | 1B5A 1BA8 11AA F0F1 2169  E28A AC55 8671 711E 31B1

Reply via email to