@@ -150,7 +150,7 @@ def SDL_CHECK_BINARY_NAME(name: str) -> bool:
150
150
except requests .RequestException :
151
151
...
152
152
153
- functions , binaryMap = {binary : {} for binary in SDL_MODULES }, {}
153
+ functions , binaryMap = {module : {} for module in SDL_MODULES }, {}
154
154
binaryData , missing = {"system" : SDL_SYSTEM , "arch" : SDL_ARCH , "files" : []}, None
155
155
binaryPath = os .environ .get ("SDL_BINARY_PATH" , os .path .join (os .path .dirname (__file__ ), "bin" ))
156
156
absPath = lambda path : path if os .path .isabs (path ) else os .path .abspath (os .path .join (binaryPath , path ))
@@ -202,15 +202,15 @@ def SDL_CHECK_BINARY_NAME(name: str) -> bool:
202
202
if int (os .environ .get ("SDL_FIND_BINARIES" , "1" if binaryData .get ("find" , missing is None ) else "0" )) > 0 :
203
203
binaryData ["files" ] += SDL_FIND_BINARIES (SDL_MODULES )
204
204
205
- for binary in SDL_MODULES :
205
+ for module in SDL_MODULES :
206
206
for path in binaryData ["files" ]:
207
- if binary in binaryMap :
207
+ if module in binaryMap :
208
208
break
209
209
210
210
if os .path .exists (path ) and SDL_CHECK_BINARY_NAME (name := os .path .split (path )[1 ]):
211
- for _binary in [binary , f"{ binary } d" ]:
212
- if (name .split ("." )[0 ] if "." in name else name ).endswith (_binary ):
213
- binaryMap [binary ] = ctypes .CDLL (os .path .abspath (path ))
211
+ for _name in [module , f"{ module } d" ]:
212
+ if (name .split ("." )[0 ] if "." in name else name ).endswith (_name ):
213
+ binaryMap [module ] = ctypes .CDLL (os .path .abspath (path ))
214
214
215
215
BaseType = typing .TypeVar ("BaseType" )
216
216
TargetType = typing .TypeVar ("TargetType" )
@@ -377,18 +377,18 @@ async def SDL_GET_LATEST_RELEASES() -> dict[str, str]:
377
377
if "SDL_GITHUB_TOKEN" in os .environ :
378
378
headers ["Authorization" ] = f"Bearer { os .environ ['SDL_GITHUB_TOKEN' ]} "
379
379
380
- for repo in SDL_MODULES :
381
- url = f"https://api.github.com/repos/libsdl-org/{ repo } /releases"
380
+ for module in SDL_MODULES :
381
+ url = f"https://api.github.com/repos/libsdl-org/{ module } /releases"
382
382
tasks .append (asyncio .create_task (session .get (url , headers = headers , ssl = False )))
383
383
SDL_LOGGER .Log (SDL_LOGGER .Info , f"Sending a request to '{ url } '." )
384
384
385
385
responses = await asyncio .gather (* tasks )
386
386
SDL_LOGGER .Log (SDL_LOGGER .Info , f"Response gathering completed ({ len (responses )} responses)." )
387
387
388
- for response , repo in zip (responses , SDL_MODULES ):
388
+ for response , module in zip (responses , SDL_MODULES ):
389
389
if response .status != 200 :
390
390
SDL_LOGGER .Log (SDL_LOGGER .Warning , f"Failed to get latest release of '{ response .url } ', skipping (status: { response .status } )." )
391
- releases [repo ] = None
391
+ releases [module ] = None
392
392
393
393
else :
394
394
latestRelease = (None , None )
@@ -399,7 +399,7 @@ async def SDL_GET_LATEST_RELEASES() -> dict[str, str]:
399
399
if not latestRelease [0 ] or score > latestRelease [0 ]:
400
400
latestRelease = (score , release ["tag_name" ])
401
401
402
- releases [repo ] = latestRelease [1 ]
402
+ releases [module ] = latestRelease [1 ]
403
403
404
404
await session .close ()
405
405
return releases
@@ -709,8 +709,8 @@ def __new__(cls, name: str, _: typing.Any, attributes: dict[str, typing.Any]) ->
709
709
710
710
if not __initialized__ :
711
711
if int (os .environ .get ("SDL_CHECK_BINARY_VERSION" , "1" )) > 0 :
712
- for binary , left , right in zip (SDL_MODULES , [SDL_GetVersion , IMG_Version , Mix_Version , TTF_Version , RTF_Version , NET_GetVersion ], [SDL_VERSION , SDL_IMAGE_VERSION , SDL_MIXER_VERSION , SDL_TTF_VERSION , SDL_RTF_VERSION , SDL_NET_VERSION ]):
713
- if binary in binaryMap and (_ := left ()) != right : SDL_LOGGER .Log (SDL_LOGGER .Warning , f"Version mismatch with binary: '{ SDL_BINARY_PATTERNS [SDL_SYSTEM ][0 ].format (binary )} ' (expected: { SDL_VERSIONNUM_STRING (right )} , got: { SDL_VERSIONNUM_STRING (_ )} )." )
712
+ for module , left , right in zip (SDL_MODULES , [SDL_GetVersion , IMG_Version , Mix_Version , TTF_Version , RTF_Version , NET_GetVersion ], [SDL_VERSION , SDL_IMAGE_VERSION , SDL_MIXER_VERSION , SDL_TTF_VERSION , SDL_RTF_VERSION , SDL_NET_VERSION ]):
713
+ if module in binaryMap and (_ := left ()) != right : SDL_LOGGER .Log (SDL_LOGGER .Warning , f"Version mismatch with binary: '{ SDL_BINARY_PATTERNS [SDL_SYSTEM ][0 ].format (module )} ' (expected: { SDL_VERSIONNUM_STRING (right )} , got: { SDL_VERSIONNUM_STRING (_ )} )." )
714
714
715
715
def SDL_TRY_WRITE_DOCS () -> bool | None :
716
716
try :
0 commit comments