Thanks for the script. That demonstrates the problem quite clearly. I have checked in a modification to hooks.py which tells cx_Freeze about the dynamic manipulation of the path. Specifically, the zope package is distributed as multiple packages but needs to be stitched back together again at runtime into a single unified whole. So, when you import "zope" it finds the first occurrence on sys.path, loads it, which in turns looks for other occurrences of itself in sys.path and modifies the package path at runtime so that when you ask for the other related packages it finds them. I have done the same thing in the hook. Interestingly enough, zope.component acts rather strangely in that it uses __import__() rather than a plain import to do its work -- I'm not sure of the reason for that but I had to add a hook for that as well.
You can follow the same procedure for the other ones that follow the same technique. If you provide me a list of them and a sample script that uses each of them so that I can test I'd be happy to include them in the stock hooks.py. If there are a lot of them I could also add a new option "namespace_packages" which essentially calls pkgutil.extend_path for those packages. Let me know what you think. Thanks. Anthony On Tue, Feb 23, 2010 at 1:03 PM, Craig Swank <[email protected]> wrote: >> No problem. Do you have a sample script that I can use? I have never >> used Zope before so have no idea how to write a minimal script that >> demonstrates the problem. Thanks! > > The most minimal script do demonstrate the problem would be to just > import both packages, but here is an example slightly more interesting > (barely): > > #setup.py > from zope.interface import Interface, implements > import zope.component > > class MyInterface(Interface): > def say_hi(arg1): > """documentation for say_hi""" > > class X: > implements(MyInterface) > > def say_hi(self, person): > print 'hi, ', person > > x = X() > x.say_hi('Anthony') > > > > and a setup script for it: > > > from cx_Freeze import setup, Executable > > version = '1.0' > includes=['zope.interface', 'zope.component'] > setup(name='hi', > version=version, > options = { > "build_exe" : { > "includes": includes, > }, > }, > executables=[Executable('example.py')], > ) > > I don't use zope.component (dont' know how). > > Thanks, > > Craig > > > > On Feb 23, 2010, at 12:40 PM, Anthony Tuininga wrote: > >> On Tue, Feb 23, 2010 at 11:31 AM, Craig Swank <[email protected]> >> wrote: >>> Try installing >>> zope.component and zope.interface (zope.interface-3.3.0.tar.gz (101 >>> K)). In >>> regards to your comment: >> >> Did that. >> >>> I believe this is a requirement for Python -- in other >>> words you can't have a module name with a "." in it without the stuff >>> in front of the dot being a package. >>> >>> I think these two packages (zope.component and zope.interface) >>> demonstrate >>> this case. In my site-packages I have both of these installed >>> (along with 5 >>> other 'zope' namespace packages), but there is not a package called >>> 'zope' >>> installed. The main app that I'm trying to build is a web-app >>> build on >>> repoze.bfg, and once again, there is no package called repoze. >>> Repoze is a >>> collection of packages. Forgive me if I'm telling you stuff you >>> already >>> know. >> >> No problem. Do you have a sample script that I can use? I have never >> used Zope before so have no idea how to write a minimal script that >> demonstrates the problem. Thanks! >> >> Anthony >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> cx-freeze-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/cx-freeze-users > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > cx-freeze-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cx-freeze-users > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ cx-freeze-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
