[Python-Dev] Freeze hacks

Guido van Rossum guido@digicool.com
Wed, 18 Jul 2001 12:32:03 -0400

> - unixccompiler, msvccompiler, cygwinccompiler,
>   bcppcompiler, mwerkscompiler, from distutils.ccompiler
> - distutils.command.* from distutils.dist

I don't expect frozen programs to use distutils.

> What is the purpose of dumbdbm not importing os directly?

I'm afraid that it's just an old way of spelling

    import os as _os

With the intention of not exporting anything undesired on "from
dumbdbm import *".  Feel free to fix it.

> To give a specific example, I'd change xml.sax.__init__ to read
> default_parser_list = ["xml.sax.expatreader"]
> if 0:
>     # freeze hack: the import relationship is not visible without this
>     # statement
>     import xml.sax.expatreader
> Is that a desirable change? If so, I'll produce a patch.

Sounds good to me.

> The case of encodings is particularly troubling: I don't think there
> is a way to tell freeze/py2exe/installer that
> print u"Hallo".encode("iso8859-2")
> will require additional modules. As a convention, I'd still recommend
> to link all this to codecs, so that an application requiring any
> codecs can do
> if 0:
>     import codecs
> explicitly, or just tell the freeze tool to use codecs, and then will
> get all codecs that are known statically.

Won't this create enormously bloated frozen binaries?

--Guido van Rossum (home page: http://www.python.org/~guido/)