44from __future__ import annotations
55
66import io
7+ import logging
78import os
89import platform
910import re
2122# This script calls a lot of programs.
2223# ruff: noqa: S603, S607, T201
2324
25+ # Ignore f-strings in logging, these will eventually be replaced with t-strings.
26+ # ruff: noqa: G004
27+
28+ logger = logging .getLogger (__name__ )
29+
30+
2431BIT_SIZE , LINKAGE = platform .architecture ()
2532
2633# Reject versions of SDL older than this, update the requirements in the readme if you change this.
@@ -133,7 +140,7 @@ def check_sdl_version() -> None:
133140 f" { needed_version } .\n sdl3-config must be on PATH."
134141 )
135142 raise RuntimeError (msg ) from exc
136- print (f"Found SDL { sdl_version_str } ." )
143+ logger . info (f"Found SDL { sdl_version_str } ." )
137144 sdl_version = tuple (int (s ) for s in sdl_version_str .split ("." ))
138145 if sdl_version < SDL_MIN_VERSION :
139146 msg = f"SDL version must be at least { needed_version } , (found { sdl_version_str } )"
@@ -150,7 +157,7 @@ def get_sdl_file(version: str) -> Path:
150157 sdl_local_file = Path ("dependencies" , sdl_archive )
151158 sdl_remote_url = f"https://www.libsdl.org/release/{ sdl_archive } "
152159 if not sdl_local_file .exists ():
153- print (f"Downloading { sdl_remote_url } " )
160+ logger . info (f"Downloading { sdl_remote_url } " )
154161 Path ("dependencies/" ).mkdir (parents = True , exist_ok = True )
155162 with requests .get (sdl_remote_url ) as response : # noqa: S113
156163 response .raise_for_status ()
@@ -167,7 +174,7 @@ def unpack_sdl(version: str) -> Path:
167174 if sdl_path .exists ():
168175 return sdl_path
169176 sdl_archive = get_sdl_file (version )
170- print (f"Extracting { sdl_archive } " )
177+ logger . info (f"Extracting { sdl_archive } " )
171178 if sdl_archive .suffix == ".zip" :
172179 with zipfile .ZipFile (sdl_archive ) as zf :
173180 zf .extractall ("dependencies/" )
0 commit comments