Skip to content

Commit

Permalink
Make middle group optional, as it does not appear in the .pyd files
Browse files Browse the repository at this point in the history
  • Loading branch information
btlorch committed Nov 20, 2023
1 parent cbae07f commit 5522e5e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/jpeglib/_bind.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,11 @@ def _versions(cls):
- ".so" (Linux and Mac),
- ".dll" (Windows Cygwin), or
- ".pyd" (similar to a Windows DLL).
Return a list of matching filenames.
"""
# Temporary printing
print(os.listdir(list(cjpeglib.__path__)[0]))
Examples are "cjpeglib_7.abi3.so" and "cjpeglib_7.pyd".
Return a list of matching filenames.
"""
so_files = [
f
for f in os.listdir(list(cjpeglib.__path__)[0])
Expand All @@ -394,7 +393,7 @@ def _bind_lib(cls, version='6b'):
all_so_files = cls._versions()

# Select the desired version
matching_so_files = list(filter(lambda f: re.fullmatch(rf'cjpeglib_{version}\..*\.(so|dll|pyd)', f), all_so_files))
matching_so_files = list(filter(lambda f: re.fullmatch(rf'cjpeglib_{version}(\..*)?\.(so|dll|pyd)', f), all_so_files))
if len(matching_so_files) == 0:
raise RuntimeError(f'version "{version}" not found')
elif len(matching_so_files) > 1:
Expand Down

0 comments on commit 5522e5e

Please sign in to comment.