Jeremy Kloth wrote: >> I don't have such a deeper knowledge of pkg_resources and freezing >> apps, but I'm getting similar errors with cx_freeze (see >> http://livingpyxml.python-hosting.com/wiki/PkgResourcesProblem). >> >> cx_freeze and py2exe don't support setuptools yet. > > They don't support .egg distributions, but they do support the use of > pkg_resources for data files. pkg_resources(Requirement('4Suite')) > won't work, but pkg_resources('Ft.Data', 'default.cat') does work.
My understanding, at this point, is that I need to register a custom loader for PYZ, which is the compressed format (bundled within the frozen application) in which pyc and pyo files are stored. Contrarary to py2exe, PyInstaller does not use zipfiles and zipimports, partly since it was written years before zipimports were available. It shouldn't be too hard. >> pyinstaller analysis system is better than cx_freeze one. Remember >> that 4suite apps needed a hack to be freezed >> (http://copia.ogbuji.net/blog/2005-12-11/Recipe_for). PyInstaller >> only fails with some C extensions. > > The "hack" you are referring to is the "hidden" imports that are > introduced by the C extensions and some runtime loading of Python > modules via __import__. Both of which cannot be found without > actually running the code against all possible inputs. For example, > all the XSLT elements are loaded on demand via a dispatch table, so > it is impossible to know that they will be required for 4XSLT to > operate. In other words, that hack, in some form or another, is > required for *ALL* freezing tools. The main difference is that PyInstaller has a flexible hook-based system which allows to bundle those hooks *within* PyInstaller itself. I suggest you give a look to the "hooks" directory in the PyInstaller distribution. > If PyInstaller at some point chooses to support zipimports, I have > fixes in the pipeline that will make it Just Work, but I don't have > time to figure out yet another freezing application. Although I have > no problems providing whatever information is needed to get > PyInstaller to support zipimports. The philosophy of PyInstaller is that you shouldn't ever modify a third-party distribution to make it work with PyInstaller. Instead, PyInstaller itself should be fixed (eg. a hook added) so that your distribution works out-of-the-box. This allows maximum flexibility for both distribution maintainers (that should not ever care about freezing tools), and PyInstaller users, which should be able to use any third-party distribution *without* doing any modification. When you say "zipimports" you mean exactly that, that is the ability of importing .pyc files stored within .zip/.egg files? Thus, may I ask why is this necessary? Is 4Suite safe-for-zip in the setuptools meaning, and thus primarly shipped as a .egg file? In that case, the manual already says that PyInstaller does not support .egg files and suggest users to easy_install distributions with -Z (--always-unzip). I had thought the main issue with 4Suite was the usage of pkg_resources to access data files (which has nothing to do with zipimports, has it?). Also, another issue I saw two weeks ago is that files like XPathParser.c import sibling modules through PyImport_ImportModuleEx, which *bypasses* any import hook. There is nothing PyInstaller could ever do to have this fixed, since PyInstaller does not use zipfiles to store .pyc files. Instead, I believe 4Suite should be fixed instead to use whatever import hook the user has installed (and thus PyInstaller's ones). -- Giovanni Bajo _______________________________________________ PyInstaller mailing list [email protected] http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller
