py2exe - omitting DLLs (not Python extensions!) from the distribution

Thomas Heller theller at python.net
Mon Mar 8 16:04:39 EST 2004


Paul Moore <pf_moore at yahoo.co.uk> writes:

> I have a Python application, which uses cx_Oracle for database access.
> I am wrapping it up into an EXE using py2exe - the result is very
> nice, and easy to distribute. However, the dependency tracking picks
> up OCI.dll as a dependency of cx_Oracle. Now, OCI.dll is actually an
> Oracle-supplied DLL, part of the Oracle client. I definitely *don't*
> want to include this in my built distribution, as it depends on the
> version of the Oracle client installed, and this may differ between
> the build machine and the target machine.
>

There's a dll_excludes option, which you can use in this way:

setup(...
      options = {"py2exe": { "dll_excludes": ["oci.dll"]}})

It would also be possible to add this to a setup.cfg file, but I prefer to
have everything in the setup script only.  That is also the reason that
there are only very few command-line options left.

> I'd rather not have to remember to delete OCI.dll as part of the build
> process.
>
> I've searched the py2exe documentation, but I can't see a way of doing
> this. Can anyone suggest a way?

For now, the documentation for advanced features is supplied by the
users and maintained in the py2exe wiki (hint, hint):

http://starship.python.net/crew/theller/moin.cgi/Py2Exe

This seems to work pretty nice (and I'd like to thank again any
contributors).

Once you have understood all the features, a short reference is included
in the py2exe docstring, which you can display by entering
help("py2exe") at the python prompt, or hit C-c C-h py-help-at-point in
a python-mode (x)emacs buffer on the 'py2exe' symbol.

Thomas





More information about the Python-list mailing list