On 3/4/2008 10:59 PM, [EMAIL PROTECTED] wrote: >>> Exactly, the metadata is key here. So there is a need to keep the egg >>> metadata in PyInstaller packaged distributions. >> The simple solution here is to embed the zipped .egg directory (.egg >> file) as DATA in PyInstaller, and then, once it's been decompressed in >> the temporary directory, put it into the PYTHONPATH. >> >> Otherwise, we can attempt something more radical. Let's see: normally, >> where and when is the egg metadata parsed? > > Once pkg_resources is imported, it creates a WorkingSet which scans > all entries in the module search path for eggs. For each egg, a > Distribution is created. Distributions expose egg metadata such as > their entry points, exactly how the metadata are accessed I wasn't > able to figure out yet from reading the source. > > I would think that the Right approach, if the eggs are embedded in the > executable, is to write a custom PEP 302 importer (like
What do you mean by "embed"? The executable is itself an archive (like a .tar). You can do two things: 1) Make it contain a single .egg file which is the whole .egg file within the executable. I don't think this is going to work because I'm not sure you can teach zipimport to open the .egg file within the executable. 2) Insert all the files (including metadata) into the executable archive (so, if you find a .egg file in site-packages, you will have to extract the files and add them one by one into the executable archive at build time). > zipimport.zipimporter) and a corresponding function that is able to > scan the executable for eggs . The former is registered by adding it > to sys.path_hooks, the latter using pkg_resources.register_finder. The > finder is responsible for creating pkg_resources.Distribution > instances. This reflects how pkg_resources itself scans directories > and zips. OK. You should be able to do this by using and extending carchive, which gives you access to the archive embedded into the executable. I suggest you read PyInstaller's manual, as it goes into details on how the single executable and the one-dir mode works and how they are composed. -- Giovanni Bajo Develer S.r.l. http://www.develer.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "PyInstaller" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/PyInstaller?hl=en -~----------~----~----~----~------~----~------~--~---
