From 25b77b73108ae08451fb06b98a787712c06298a5 Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Thu, 23 Oct 2025 19:33:13 -0500 Subject: [PATCH] Fix encoding for Windows (#22) --- .github/workflows/ci.yml | 12 +++++++++++- yt_dlp_ejs/yt/solver/__init__.py | 8 ++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4279b9..86d2635 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,10 +71,11 @@ jobs: python_tests: name: Python tests - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} strategy: fail-fast: false matrix: + runner: [ubuntu-latest, windows-latest] python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', pypy-3.11] steps: - uses: actions/checkout@v5 @@ -93,7 +94,15 @@ jobs: # `pip install -e` omits the force-included JS, so use `build` instead python -m pip install -U build python -m build + - name: Unpack wheel (Linux) + if: matrix.runner == 'ubuntu-latest' + run: | unzip -u dist/yt_dlp_ejs-*.whl "yt_dlp_ejs/*" + - name: Unpack wheel (Windows) + if: matrix.runner == 'windows-latest' + shell: pwsh + run: | + Expand-Archive -Path dist/yt_dlp_ejs-*.whl -DestinationPath ./ -Force - name: Run Python tests timeout-minutes: 5 run: | @@ -354,6 +363,7 @@ jobs: - ruff-lint - prettier - eslint + - python_tests - deno_build - deno_tests - bun_build diff --git a/yt_dlp_ejs/yt/solver/__init__.py b/yt_dlp_ejs/yt/solver/__init__.py index c69f0ce..8f71c47 100644 --- a/yt_dlp_ejs/yt/solver/__init__.py +++ b/yt_dlp_ejs/yt/solver/__init__.py @@ -7,11 +7,15 @@ def core() -> str: """ Read the contents of the JavaScript core solver bundle as string. """ - return (importlib.resources.files(yt_dlp_ejs.yt.solver) / "core.min.js").read_text() + return (importlib.resources.files(yt_dlp_ejs.yt.solver) / "core.min.js").read_text( + encoding="utf-8" + ) def lib() -> str: """ Read the contents of the JavaScript library solver bundle as string. """ - return (importlib.resources.files(yt_dlp_ejs.yt.solver) / "lib.min.js").read_text() + return (importlib.resources.files(yt_dlp_ejs.yt.solver) / "lib.min.js").read_text( + encoding="utf-8" + )