py_runtime 規則傳回的 Python 執行階段相關資訊。Python 執行階段是指平台執行階段或建構內執行階段。平台執行階段會存取已知路徑的系統安裝解譯器,而建構內執行階段則會指向做為解譯器的 File。在上述兩種情況中,「解譯器」實際上是指任何可執行的二進位檔或包裝函式指令碼,能夠執行在指令列中傳遞的 Python 指令碼,並遵循與標準 CPython 解譯器相同的慣例。
成員
- PyRuntimeInfo
- bootstrap_template
- coverage_files
- coverage_tool
- files
- interpreter
- interpreter_path
- python_version
- stub_shebang
PyRuntimeInfo
PyRuntimeInfo PyRuntimeInfo(interpreter_path=None, interpreter=None, files=None, coverage_tool=None, coverage_files=None, python_version, stub_shebang=None, bootstrap_template=None)
PyRuntimeInfo 建構函式。
參數
| 參數 | 說明 |
|---|---|
interpreter_path
|
string 或 None;預設值為 None新物件 interpreter_path 欄位的值。如果您傳遞 interpreter,請勿為這個引數提供值。
|
interpreter
|
File 或 None;預設值為 None新物件 interpreter 欄位的值。如果您傳遞 interpreter_path,請勿為這個引數提供值。
|
files
|
File 的 depset;或 None;
預設值為 None新物件 files 欄位的值。如果傳遞 interpreter_path,請勿為這個引數提供值。如果指定 interpreter,且這個引數為 None,則 files 會改為空白的 depset。 |
coverage_tool
|
File 或 None;預設值為 None新物件 coverage_tool 欄位的值。 |
coverage_files
|
File 的 depset;或 None;
預設值為 None新物件 coverage_files 欄位的值。如果沒有傳遞 coverage_tool,請勿為這個引數提供值。
|
python_version
|
必要 新物件的 python_version 欄位值。
|
stub_shebang
|
string;
預設值為 None新物件 stub_shebang 欄位的值。如果為 None 或未指定,則使用 #!/usr/bin/env python3。
|
bootstrap_template
|
檔案;或 None;
預設值為 None |
bootstrap_template
File PyRuntimeInfo.bootstrap_template
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
depset 的 File,需要新增至使用這個執行階段的可執行目標的執行檔案 (特別是 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 目標時使用的 Python 啟動程式碼片段指令碼。不適用於 Windows。