mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 18:40:59 +02:00
fix(tools): pre-commit fixes for qemu_ext.py
This commit is contained in:
@@ -13,8 +13,6 @@ import sys
|
|||||||
import time
|
import time
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Dict
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from click.core import Context
|
from click.core import Context
|
||||||
|
|
||||||
@@ -54,7 +52,7 @@ class QemuTarget:
|
|||||||
# To generate the default eFuse values, follow the instructions in
|
# To generate the default eFuse values, follow the instructions in
|
||||||
# https://github.com/espressif/esp-toolchain-docs/blob/main/qemu/esp32/README.md#using-esptoolpy-and-espefusepy-to-interact-with-qemu
|
# https://github.com/espressif/esp-toolchain-docs/blob/main/qemu/esp32/README.md#using-esptoolpy-and-espefusepy-to-interact-with-qemu
|
||||||
# and burn the eFuses which should be set by default. Then take the binary file, convert it to hex, and paste it here.
|
# and burn the eFuses which should be set by default. Then take the binary file, convert it to hex, and paste it here.
|
||||||
QEMU_TARGETS: Dict[str, QemuTarget] = {
|
QEMU_TARGETS: dict[str, QemuTarget] = {
|
||||||
'esp32': QemuTarget(
|
'esp32': QemuTarget(
|
||||||
'esp32',
|
'esp32',
|
||||||
'qemu-system-xtensa',
|
'qemu-system-xtensa',
|
||||||
@@ -178,12 +176,12 @@ def wait_for_socket(port: int, timeout_sec: float = 10.0) -> None:
|
|||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
|
|
||||||
def action_extensions(base_actions: Dict, project_path: str) -> Dict:
|
def action_extensions(base_actions: dict, project_path: str) -> dict:
|
||||||
# Shared state between "global_callback" and "qemu" action.
|
# Shared state between "global_callback" and "qemu" action.
|
||||||
# Stores options which depend on the presence of other tasks.
|
# Stores options which depend on the presence of other tasks.
|
||||||
options = QemuTaskRunOptions()
|
options = QemuTaskRunOptions()
|
||||||
|
|
||||||
def global_callback(ctx: Context, global_args: Dict, tasks: List) -> None:
|
def global_callback(ctx: Context, global_args: dict, tasks: list) -> None:
|
||||||
# This callback lets us customize QEMU launch arguments depending on the presence of other tasks.
|
# This callback lets us customize QEMU launch arguments depending on the presence of other tasks.
|
||||||
def have_task(name: str) -> bool:
|
def have_task(name: str) -> bool:
|
||||||
return any(fnmatch.fnmatch(task.name, name) for task in tasks)
|
return any(fnmatch.fnmatch(task.name, name) for task in tasks)
|
||||||
@@ -219,7 +217,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
|
|||||||
desc_path = os.path.join(args.build_dir, 'project_description.json')
|
desc_path = os.path.join(args.build_dir, 'project_description.json')
|
||||||
if not os.path.exists(desc_path):
|
if not os.path.exists(desc_path):
|
||||||
ensure_build_directory(args, ctx.info_name)
|
ensure_build_directory(args, ctx.info_name)
|
||||||
with open(desc_path, 'r', encoding='utf-8') as f:
|
with open(desc_path, encoding='utf-8') as f:
|
||||||
project_desc = json.load(f)
|
project_desc = json.load(f)
|
||||||
return project_desc
|
return project_desc
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user