diff options
author | Georg Brandl <georg@python.org> | 2010-12-04 10:26:46 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-12-04 10:26:46 (GMT) |
commit | 8334fd9285a8e9f0864b0453ae738fe3f6893b21 (patch) | |
tree | f9341847b4647cd85b6fcd4e5fbece5cd15e1883 /Doc/library/compileall.rst | |
parent | 427d3149ebe5c4495e69a04be5464e5b8b446c9e (diff) | |
download | cpython-8334fd9285a8e9f0864b0453ae738fe3f6893b21.zip cpython-8334fd9285a8e9f0864b0453ae738fe3f6893b21.tar.gz cpython-8334fd9285a8e9f0864b0453ae738fe3f6893b21.tar.bz2 |
Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile.
Diffstat (limited to 'Doc/library/compileall.rst')
-rw-r--r-- | Doc/library/compileall.rst | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst index 63ddc99..1835b31 100644 --- a/Doc/library/compileall.rst +++ b/Doc/library/compileall.rst @@ -58,7 +58,7 @@ compile Python sources. Public functions ---------------- -.. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False, legacy=False) +.. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False, legacy=False, optimize=-1) Recursively descend the directory tree named by *dir*, compiling all :file:`.py` files along the way. The *maxlevels* parameter is used to limit the depth of @@ -76,14 +76,23 @@ Public functions If *legacy* is true, old-style ``.pyc`` file path names are written, otherwise (the default), :pep:`3147`-style path names are written. + *optimize* specifies the optimization level for the compiler. It is passed to + the built-in :func:`compile` function. -.. function:: compile_path(skip_curdir=True, maxlevels=0, force=False, legacy=False) + .. versionchanged:: 3.2 + Added the *optimize* parameter. + + +.. function:: compile_path(skip_curdir=True, maxlevels=0, force=False, legacy=False, optimize=-1) Byte-compile all the :file:`.py` files found along ``sys.path``. If *skip_curdir* is true (the default), the current directory is not included in - the search. The *maxlevels* parameter defaults to ``0``, and the *force* - and *legacy* parameters default to ``False``. All are - passed to the :func:`compile_dir` function. + the search. All other parameters are passed to the :func:`compile_dir` + function. + + .. versionchanged:: 3.2 + Added the *optimize* parameter. + To force a recompile of all the :file:`.py` files in the :file:`Lib/` subdirectory and all its subdirectories:: |