> The code you reference is for module specific exclusions. Ordinarily > that dictionary is empty but if you look at hooks.py you will find > plenty of places where module.ExcludeName() is called. The excludes > themselves are simply put into the list of modules found by the finder > with a value of None. There are ways of forcing the value back in -- > which is another reason why I'd like to know what is causing the > import in the first place to see if a hook is causing it. If that is > the case I'll find some way of forcing it to __stay__ excluded. :-)
I've done some more digging into this. A hook (load_Tkinter() in hooks.py) is involved - it does both "import Tkinter" (which raises an ImportError, when it tries to import _tkinter) and "import _tkinter" (which would raise an ImportError if the code got that far). My limited understanding is that if these imports fail, the module shouldn't be included (since it's not available). In terms of the 'excludes' list - It looks like when createLibraryZip is True, the excludes list of the Executable object does not come into play, because (in _FreezeExecutable() in freezer.py) the global module finder is used, rather than one created based on the settings in the Executable object. However, I can get it to work from the command-line (using the example code in my previous post) with `python freeze_test.py build_exe --excludes=Tkinter` (I must have been doing something wrong in my previous attempts to use the command-line options). This doesn't work in the code, because "excludes" isn't a known attribute. I think to get that to work, the Distribution class in cx_Freeze/dist.py would need to be told about the "excludes" option (since the regular distutils Distribution class is unaware of it). To sum up: I think that the cx_Freeze.dist.Distribution class should support "excludes". I suspect that "excludes" values in Executables should be passed to the global module finder when createLibraryZip is true. I wonder if the load_Tkinter() hook should fail to add Tkinter if it cannot be imported. However, for now I can make do by invoking on the command-line or monkey-patching. All of this is conjecture based on trawling through the source, so I may be making incorrect assumptions in places. I hope this information is useful, however. Please let me know if I can provide any more! Thanks, Tony ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ cx-freeze-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
