Differences between revisions 5 and 8 (spanning 3 versions)
Revision 5 as of 2009-03-18 21:54:38
Size: 3070
Editor: jzinner
Comment:
Revision 8 as of 2009-03-18 22:17:54
Size: 3326
Editor: jzinner
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
The Distutils module is part of the standard python distribution. Distutils is used by python module developers to package and distribute new modules. The setup syntax py2exe uses is inherited from distutils. (If you choose the default Windows installation for python, distutils can be found at: C:/Program Files/Python##/Lib/distutils/). The setup function of Distutil [[http://docs.python.org/dist/module-distutils.core.html|recognizes specific keywords]], which are also available when running py2exe. The Distutils module is part of the standard python distribution. Distutils is used by python module developers to package and distribute new modules. The setup syntax py2exe uses is inherited from distutils. (If you choose the default Windows installation for python, distutils can be found at: C:/Program Files/Python##/Lib/distutils/). The setup function of Distutil [[http://docs.python.org/dist/module-distutils.core.html|recognizes specific keywords]], which are also available when running py2exe.  The following is a list of some more useful distutils keywords
Line 4: Line 4:
||<tablewidth="820px" tableheight="48px">'''keyword'''||'''description'''||
|| [[data_files]]|| list of "data" files that you are going to need to run your executable such as .pngs, .jpgs||

What you need to understand about Distutils:

The Distutils module is part of the standard python distribution. Distutils is used by python module developers to package and distribute new modules. The setup syntax py2exe uses is inherited from distutils. (If you choose the default Windows installation for python, distutils can be found at: C:/Program Files/Python##/Lib/distutils/). The setup function of Distutil recognizes specific keywords, which are also available when running py2exe. The following is a list of some more useful distutils keywords

keyword

description

data_files

list of "data" files that you are going to need to run your executable such as .pngs, .jpgs

Py2exe extends Distutils setup keywords

In addition to the standard distutils setup keywords, the following py2exe keywords specify what and how to build.

keyword

description

console

list of scripts to convert into console exes

windows

list of scripts to convert into GUI exes

service

list of module names containing win32 service classes

com_server

list of module names containing com server classes

ctypes_com_server

list of module names containing com server classes

zipfile

name of shared zipfile to generate; may specify a subdirectory; defaults to 'library.zip'

options

dictionary { "py2exe": { "opt1": val1, "opt2": val2, ... } }

The options dictionary of py2exe

The option keyword takes the following set of dictionary key: value pairs. The dictionary "key" names and the "value" types are listed in the table below.

key

value

unbuffered

if true, use unbuffered binary stdout and stderr

optimize

string or int of optimization level (0, 1, or 2)

includes

list of module names to include

packages

list of packages to include with subpackages

ignores

list of modules to ignore if they are not found

excludes

list of module names to exclude

dll_excludes

list of dlls to exclude

dist_dir

directory in which to build the final files

typelibs

list of gen_py generated typelibs to include

compressed

(boolean) create a compressed zipfile

xref

(boolean) create and show a module cross reference

bundle-files

bundle dlls in the zipfile or the exe. Valid levels are 1, 2, or 3 (default)

skip-archive

(boolean) do not place Python bytecode files in an archive, put them directly in the file system

ascii

(boolean) do not automatically include encodings and codecs

custom-boot-script

Python file that will be run when setting up the runtime environment

Example:

setup(
        windows=['trypyglet.py'],
        options={
                "py2exe":{
                        "unbuffered": True,
                        "optimize": 2,
                        "excludes": ["email"]
                }
        }
)

For more information enter the following at the python command line:

>>> from distutils.core import setup
>>> help(setup

ListOfOptions (last edited 2009-11-04 16:59:32 by FlorianHoech)