[Distutils] SETUPTOOLS - Loading Eggs which do not have an egg_info
Ilias Lazaridis
ilias at lazaridis.com
Thu Dec 7 17:24:17 CET 2006
Phillip J. Eby wrote:
> At 03:41 PM 12/7/2006 +0200, Ilias Lazaridis wrote:
>> Is there any documented way to load such a "raw egg" (egg sources
>> without a generated egg-info) into the application, without the need to
>> generate the egg-info?
>
> No. Of course, if you know where the plugin directories are, you can
> always run their "setup.py egg_info" to generate it.
This is what I do, from within my programm, and it works fine.
But I like to avoid this step.
-
I currently try to use the setuptools code to instantiate an egg from
the setup.py file (which contains all information), and to apply then
the functions from pkg_resources.
Looks somehow like this:
from distutils.core import run_setup
dist = run_setup( setuppys[0],None,'init')
print dist
loaded_components = []
module = []
import pkg_resources
for name in pkg_resources.get_entry_map(dist,'trac.plugins'):
entry_point =
pkg_resources.get_entry_info(dist,trac.plugins', name)
entry_point.load()
but this fails, I must have missed some point.
(('Expected string, Requirement, or Distribution', ))
although "dist" is an:
<setuptools.dist.Distribution instance at 0x0187E260>
-
How can I create an egg representing object (from the sources/setup.py),
from which I can load the entry-points afterwards, without having to
generate an egg_info on the file-system?
.
--
http://lazaridis.com
More information about the Distutils-SIG
mailing list