Differences between revisions 7 and 12 (spanning 5 versions)
Revision 7 as of 2009-03-18 22:08:36
Size: 3322
Editor: jzinner
Comment:
Revision 12 as of 2009-08-14 19:12:22
Size: 3550
Editor: ciphergoth
Comment: missing parenthesis
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
||<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 ||
Line 4: Line 6:
||<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||

Line 9: Line 11:

||<tablewidth="820px" tableheight="198px">'''keyword'''||'''description'''||
||<tablewidth="820px" tableheight="198px">'''keyword''' ||'''description''' ||
Line 19: Line 20:


Line 20: Line 24:
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.   
||<tablewidth="820px" tableheight="227px">'''key'''|| '''value'''||
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.
||<tablewidth="820px" tableheight="227px">'''key''' || '''value''' ||
Line 24: Line 27:
||optimize || string or int of optimization level (0, 1, or 2) || ||optimize || string or int of optimization level (0, 1, or 2) 0 = don’t optimize (generate .pyc) 1 = normal optimization (like python -O) 2 = extra optimization (like python -OO) See http://docs.python.org/distutils/apiref.html#module-distutils.util for more info. ||
Line 33: Line 36:
|| 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 ||
||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 ||
Line 38: Line 41:


Line 57: Line 63:
>>> help(setup}}} >>> help(setup)
}}}

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) 0 = don’t optimize (generate .pyc) 1 = normal optimization (like python -O) 2 = extra optimization (like python -OO) See http://docs.python.org/distutils/apiref.html#module-distutils.util for more info.

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)