HTTP: prefer pip-system-certs/certifi_win32 bundle; use init-time verify in retries; add tests

This commit is contained in:
2026-01-05 13:09:24 -08:00
parent 1f765cffda
commit ac1d1d634f
12 changed files with 19424 additions and 2371 deletions

View File

@@ -128,12 +128,24 @@ def _doc_convert(input_path: Path, output_path: Path) -> bool:
return False
target_fmt = output_path.suffix.lstrip(".").lower() or "pdf"
extra_args = []
if target_fmt == "pdf":
tectonic_path = shutil.which("tectonic")
if not tectonic_path:
log(
"tectonic is required for PDF output; install with `pip install tectonic`",
file=sys.stderr,
)
return False
extra_args = ["--pdf-engine=tectonic"]
try:
pypandoc.convert_file(
str(input_path),
to=target_fmt,
outputfile=str(output_path),
extra_args=extra_args,
)
except OSError as exc:
log(f"pandoc is missing or failed to run: {exc}", file=sys.stderr)
@@ -163,7 +175,7 @@ CMDLET = Cmdlet(
detail=[
"Allows video↔video, audio↔audio, image↔image, doc↔doc, and video→audio conversions.",
"Disallows incompatible conversions (e.g., video→pdf).",
"Uses ffmpeg for media and pypandoc-binary (bundled pandoc) for document formats (mobi/epub→pdf/txt/etc).",
"Uses ffmpeg for media and pypandoc-binary (bundled pandoc) for document formats (mobi/epub→pdf/txt/etc); PDF output uses the tectonic LaTeX engine when available.",
],
)