Misc. fixes #2.

This commit is contained in:
2026-05-25 02:37:51 +00:00
parent e86f1e22de
commit 17c5a47936
15 changed files with 46 additions and 29 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ from pathlib import Path
# Import util.py from scripts/fastapi-vue (not a package, so we adjust sys.path)
sys.path.insert(0, str(Path(__file__).with_name("fastapi-vue")))
from devutil import ( # type: ignore
from devutil import ( # type: ignore[import-not-found]
ProcessGroup,
check_ports_free,
logger,
+3 -1
View File
@@ -3,7 +3,9 @@
import sys
from pathlib import Path
from hatchling.builders.hooks.plugin.interface import BuildHookInterface # type: ignore
from hatchling.builders.hooks.plugin.interface import ( # type: ignore[import-not-found]
BuildHookInterface,
)
sys.path.insert(0, str(Path(__file__).parent))
from buildutil import build
+8 -3
View File
@@ -9,7 +9,7 @@ import sys
from collections.abc import Coroutine
from contextlib import suppress
from pathlib import Path
from typing import Any
from typing import Any, Self
import httpx
from buildutil import find_dev_tool, find_install_tool, logger
@@ -58,10 +58,15 @@ class ProcessGroup:
logger.warning("%s failed with exit status %d", e.cmd, e.returncode)
raise SystemExit(1) from None
async def __aenter__(self):
async def __aenter__(self) -> Self:
"""Return this process group context manager."""
return self
async def __aexit__(self, exc_type, *_):
async def __aexit__(
self,
exc_type: type[BaseException] | None,
*_: object,
) -> None:
"""Wait for one process to exit, terminate others, then wait for all."""
await self._cleanup(immediate=exc_type is not None)
+4 -4
View File
@@ -74,8 +74,8 @@ def fetch_ffmpeg() -> Path:
ffmpeg_entry = next(
name for name in zf.namelist() if name.endswith("/bin/ffmpeg.exe")
)
with zf.open(ffmpeg_entry) as src, Path(dest).open("wb") as out:
out.write(src.read())
with zf.open(ffmpeg_entry) as src:
Path(dest).write_bytes(src.read())
print(f"ffmpeg staged at {dest} ({dest.stat().st_size // 1024 // 1024} MB)")
return dest
@@ -109,8 +109,8 @@ def fetch_macos_arm64_binaries() -> dict[str, Path]:
for name in zf.namelist()
if Path(name).name == tool_name and not name.endswith("/")
)
with zf.open(entry_name) as src, Path(dest).open("wb") as out:
out.write(src.read())
with zf.open(entry_name) as src:
Path(dest).write_bytes(src.read())
dest.chmod(dest.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
+1 -1
View File
@@ -202,7 +202,7 @@ def format_size(size_bytes: int | None) -> str:
def main() -> None:
"""Main entry point for the torrent scanner."""
"""Run the torrent scanner command-line workflow."""
parser = argparse.ArgumentParser(
description="Scan and manage torrent files",
formatter_class=argparse.RawDescriptionHelpFormatter,