Skip to content

Commit 6c24694

Browse files
encukoufrenzymadness
authored andcommitted
Adjust documentation
1 parent 1009e79 commit 6c24694

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

Doc/library/compileall.rst

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ compile Python sources.
5252
cases where the source file does not exist at the time the byte-code file is
5353
executed.
5454

55+
.. cmdoption:: -s strip_prefix
56+
.. cmdoption:: -p prepend_prefix
57+
58+
Remove (``-s``) or append (``-p``) the given prefix of paths
59+
recorded in the ``.pyc`` files.
60+
Raises :exc:`ValueError` if combined with ``-d``.
61+
5562
.. cmdoption:: -x regex
5663

5764
regex is used to search the full path to each file considered for
@@ -96,6 +103,16 @@ compile Python sources.
96103
variable is not set, and ``checked-hash`` if the ``SOURCE_DATE_EPOCH``
97104
environment variable is set.
98105

106+
.. cmdoption:: -o level
107+
108+
Compile with the given optimization level. May be used multiple times
109+
to compile for multiple levels at a time (for example,
110+
``compileall -o 1 -o 2``).
111+
112+
.. cmdoption:: -e dir
113+
114+
Ignore symlinks pointing outside the given directory.
115+
99116
.. versionchanged:: 3.2
100117
Added the ``-i``, ``-b`` and ``-h`` options.
101118

@@ -107,6 +124,12 @@ compile Python sources.
107124
.. versionchanged:: 3.7
108125
Added the ``--invalidation-mode`` option.
109126

127+
.. versionchanged:: 3.9
128+
Added the ``-s``, ``-p``, ``-e`` options.
129+
Raised the default default recursion limit from 10 to
130+
:py:func:`sys.getrecursionlimit()`.
131+
Added the possibility to specify the ``-o`` option multiple times.
132+
110133

111134
There is no command-line option to control the optimization level used by the
112135
:func:`compile` function, because the Python interpreter itself already
@@ -120,7 +143,7 @@ runtime.
120143
Public functions
121144
----------------
122145

123-
.. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, workers=1, invalidation_mode=None)
146+
.. function:: compile_dir(dir, maxlevels=sys.getrecursionlimit(), ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, workers=1, invalidation_mode=None, stripdir=None, prependdir=None, limit_sl_dest=None)
124147

125148
Recursively descend the directory tree named by *dir*, compiling all :file:`.py`
126149
files along the way. Return a true value if all the files compiled successfully,
@@ -166,6 +189,10 @@ Public functions
166189
:class:`py_compile.PycInvalidationMode` enum and controls how the generated
167190
pycs are invalidated at runtime.
168191

192+
The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to
193+
the ``-s``, ``-p`` and ``-e`` options described above.
194+
They may be specified as ``str``, ``bytes`` or :py:class:`os.PathLike`.
195+
169196
.. versionchanged:: 3.2
170197
Added the *legacy* and *optimize* parameter.
171198

@@ -191,6 +218,9 @@ Public functions
191218
.. versionchanged:: 3.8
192219
Setting *workers* to 0 now chooses the optimal number of cores.
193220

221+
.. versionchanged:: 3.9
222+
Added *stripdir*, *prependdir* and *limit_sl_dest* arguments.
223+
194224
.. function:: compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, invalidation_mode=None)
195225

196226
Compile the file with path *fullname*. Return a true value if the file
@@ -223,6 +253,10 @@ Public functions
223253
:class:`py_compile.PycInvalidationMode` enum and controls how the generated
224254
pycs are invalidated at runtime.
225255

256+
The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to
257+
the ``-s``, ``-p`` and ``-e`` options described above.
258+
They may be specified as ``str``, ``bytes`` or :py:class:`os.PathLike`.
259+
226260
.. versionadded:: 3.2
227261

228262
.. versionchanged:: 3.5
@@ -238,6 +272,9 @@ Public functions
238272
.. versionchanged:: 3.7.2
239273
The *invalidation_mode* parameter's default value is updated to None.
240274

275+
.. versionchanged:: 3.9
276+
Added *stripdir*, *prependdir* and *limit_sl_dest* arguments.
277+
241278
.. function:: compile_path(skip_curdir=True, maxlevels=0, force=False, quiet=0, legacy=False, optimize=-1, invalidation_mode=None)
242279

243280
Byte-compile all the :file:`.py` files found along ``sys.path``. Return a

0 commit comments

Comments
 (0)