py_runtime 規則傳回的 Python 執行階段相關資訊。Python 執行階段會說明平台執行階段或建構執行階段。平台執行階段會在已知路徑存取系統安裝的解譯器,而建構執行階段指向做為解譯器的 File。無論是哪種情況,是任何能夠執行 Python 指令碼執行命令列的可執行二進位或包裝函式指令碼,並且遵循標準 CPython 解譯器的慣例。
成員
PyRuntimeInfo
PyRuntimeInfo PyRuntimeInfo(interpreter_path=None, interpreter=None, files=None, coverage_tool=None, coverage_files=None, python_version, stub_shebang='#!/usr/bin/env python3')
PyRuntimeInfo 建構函式。
參數
| 參數 | 說明 |
|---|---|
interpreter_path
|
string; or None;
預設值 = 無新物件的 interpreter_path 欄位值。如果傳入 interpreter,請勿為此引數提供值。
|
interpreter
|
File; or None;
預設值 = 無新物件的 interpreter 欄位值。如果傳入 interpreter_path,請勿為此引數提供值。
|
files
|
depset of Files; or None;
預設值 = 無新物件的 files 欄位值。如果傳入 interpreter_path,請勿為此引數提供值。如果提供了 interpreter 且這個引數為 None,則 files 會改為空白的 depset。
|
coverage_tool
|
File; or None;
預設值 = 無新物件的 coverage_tool 欄位值。
|
coverage_files
|
depset of Files; or None;
預設值 = 無新物件的 coverage_files 欄位值。如未一併傳入 coverage_tool,請勿提供這個引數的值。
|
python_version
|
必要 新物件 python_version 欄位的值。
|
stub_shebang
|
string;
預設值 = '#!/usr/bin/env python3'新物件的 stub_shebang 欄位值。預設值為 #!/usr/bin/env python3。
|
coverage_files
depset PyRuntimeInfo.coverage_files
coverage_tool 所需的檔案。如未提供 coverage_tool,將會是 None。
可能會傳回 None。
coverage_tool
File PyRuntimeInfo.coverage_tool
File,代表用於從 Python 測試收集程式碼涵蓋率資訊的工具。否則就是 None。
可能會傳回 None。
檔案
depset PyRuntimeInfo.files
File 的 depset,必須新增至使用該執行階段目標的執行檔案 (尤其是 interpreter 需要的檔案)。請勿加入這個欄位中的 interpreter 值。如果這是平台執行階段,則這個欄位為 None。
可能會傳回 None。
翻譯模式
File PyRuntimeInfo.interpreter
File。否則就是 None。請注意,建構執行階段可使用預先建構的已勾選的解譯器,或是以來源建構的解譯器。
可能會傳回 None。
interpreter_path
string PyRuntimeInfo.interpreter_path
None。
可能會傳回 None。
python_version
string PyRuntimeInfo.python_version
"PY2" 和 "PY3"。
stub_shebang
string PyRuntimeInfo.stub_shebang
py_binary 目標。不適用於 Windows。