Python executable used to compile to bytecode.
Exception |
|
A compilation error. |
Exception |
|
Undocumented |
Function | can |
Undocumented |
Function | compile |
Compile Python source code to pyc data. |
Function | get |
Get a python executable corresponding to version. |
Function | _get |
Determine the major and minor version of given Python executable. |
Function | _get |
Find possible python executables to use. |
Function | _load |
Get the contents of a data file. |
Function | _parse |
Parse the version string of a Python executable. |
Function | _path |
Get the full path to a custom python exe in the pytype/ src directory. |
Constant | _COMPILE |
Undocumented |
Constant | _COMPILE |
Undocumented |
Constant | _CUSTOM |
Undocumented |
List[ str]
, mode='exec'):
(source)
¶
Compile Python source code to pyc data. This may use py_compile if the src is for the same version as we're running, or else it spawns an external process to produce a .pyc file. The generated bytecode (.pyc file) is read and both it and any temporary files are deleted. Args: src: Python sourcecode filename: Name of the source file. For error messages. python_version: Python version, (major, minor). python_exe: A path to a Python interpreter. mode: Same as builtins.compile: "exec" if source consists of a sequence of statements, "eval" if it consists of a single expression, or "single" if it consists of a single interactive statement. Returns: The compiled pyc file as a binary string. Raises: CompileError: If we find a syntax error in the file. IOError: If our compile script failed.
Get a python executable corresponding to version. Args: version: The required python version Returns: - None: The current host interpreter can compile `version` - [path-to-exe, args]: A valid python-`version` interpreter Raises: PythonNotFoundError: if no suitable interpreter is found.
Determine the major and minor version of given Python executable. Arguments: python_exe: absolute path to the Python executable Returns: Version as (major, minor) tuple, or None if it could not be determined.
Find possible python executables to use. Arguments: python_version: the version tuple (e.g. (3, 7)) Yields: The path to the executable
Parse the version string of a Python executable. Arguments: version_str: Version string as emitted by running `PYTHON_EXE -V` Returns: Version as (major, minor) tuple, or None if it could not be determined.