diff --git a/.github/docs-versions.yml b/.github/docs-versions.yml index 0091b53d60..264024d9a3 100644 --- a/.github/docs-versions.yml +++ b/.github/docs-versions.yml @@ -8,16 +8,16 @@ # To add a new release version: append an entry under `versions:`, and update # `default:` / `stable:` if the new release should become the landing page. -default: "1.0.0" # served at the site root (microsoft.github.io/PyRIT/) -stable: "1.0.0" # served at /stable/ and shown as "(stable)" in the picker +default: "1.0.1" # served at the site root (microsoft.github.io/PyRIT/) +stable: "1.0.1" # served at /stable/ and shown as "(stable)" in the picker versions: - slug: latest name: "latest (dev, main)" ref: main - - slug: "1.0.0" - name: "1.0.0" - ref: releases/v1.0.0 + - slug: "1.0.1" + name: "1.0.1" + ref: releases/v1.0.1 - slug: "0.14.0" name: "0.14.0" ref: releases/v0.14.0 diff --git a/build_scripts/prepare_package.py b/build_scripts/prepare_package.py index 4be8b5e38c..83f81ee83b 100644 --- a/build_scripts/prepare_package.py +++ b/build_scripts/prepare_package.py @@ -6,12 +6,30 @@ This builds the TypeScript/React frontend and copies artifacts into the Python package structure. """ +import contextlib import shutil import subprocess import sys from pathlib import Path +def _configure_utf8_stdio() -> None: + """ + Force UTF-8 encoding on stdout/stderr so status glyphs cannot abort the build. + + On Windows, Python encodes standard output with the legacy ANSI code page (e.g. cp1252) + whenever it is not attached to a console -- piped, redirected, or captured by CI. The + non-ASCII status characters printed below are not representable there, so the print + raises ``UnicodeEncodeError`` and a purely decorative character fails the build. + """ + for stream in (sys.stdout, sys.stderr): + reconfigure = getattr(stream, "reconfigure", None) + if reconfigure is None: + continue + with contextlib.suppress(OSError, ValueError): + reconfigure(encoding="utf-8", errors="replace") + + def build_frontend(frontend_dir: Path) -> bool: """ Build the TypeScript/React frontend using npm. @@ -116,8 +134,10 @@ def copy_frontend_to_package(frontend_dist: Path, backend_frontend: Path) -> boo return False -def main(): +def main() -> int: """Build frontend and prepare package for distribution.""" + _configure_utf8_stdio() + # Define paths root = Path(__file__).parent.parent frontend_dir = root / "frontend"