Clean up byte-compilation code in packaging (#11254 followup).
- Don't use keyword arguments for debug_override; I find it more
readable to have a comment explaining that True makes pyc and False
pyo than to write out the non-obvious (when you haven’t read the doc)
argument name
- Move duplicate code from build_py and install_lib into cmd
- Remove obsolete verbose argument of util.byte_compile
- Remove obsolete passing of -O/-OO to the Python process spawned by
util.byte_compile (I’ll remove the whole spawning later, after I write
more tests to check the contents of pyc and pyo files; now that
byte_compile does not depend on the value of __debug__ in the calling
Python, we can call py_compile or compileall directly)
diff --git a/Doc/library/packaging.util.rst b/Doc/library/packaging.util.rst
index 2b3103c..7513249 100644
--- a/Doc/library/packaging.util.rst
+++ b/Doc/library/packaging.util.rst
@@ -90,7 +90,7 @@
Search the path for a given executable name.
-.. function:: execute(func, args[, msg=None, verbose=0, dry_run=0])
+.. function:: execute(func, args, msg=None, verbose=0, dry_run=0)
Perform some action that affects the outside world (for instance, writing to
the filesystem). Such actions are special because they are disabled by the
@@ -117,7 +117,8 @@
:exc:`ValueError` if *val* is anything else.
-.. function:: byte_compile(py_files[, optimize=0, force=0, prefix=None, base_dir=None, verbose=1, dry_run=0, direct=None])
+.. function:: byte_compile(py_files, optimize=0, force=0, prefix=None, \
+ base_dir=None, dry_run=0, direct=None)
Byte-compile a collection of Python source files to either :file:`.pyc` or
:file:`.pyo` files in a :file:`__pycache__` subdirectory (see :pep:`3147`),
@@ -131,6 +132,9 @@
* ``1`` - normal optimization (like ``python -O``)
* ``2`` - extra optimization (like ``python -OO``)
+ This function is independent from the running Python's :option:`-O` or
+ :option:`-B` options; it is fully controlled by the parameters passed in.
+
If *force* is true, all files are recompiled regardless of timestamps.
The source filename encoded in each :term:`bytecode` file defaults to the filenames
@@ -149,6 +153,3 @@
figure out to use direct compilation or not (see the source for details).
The *direct* flag is used by the script generated in indirect mode; unless
you know what you're doing, leave it set to ``None``.
-
- This function is independent from the running Python's :option:`-O` or
- :option:`-B` options; it is fully controlled by the parameters passed in.