Skip to content

Commit d7d84f8

Browse files
desty2kclaude
andcommitted
fix: pack plain .so/.dylib files as resources, not code
Resource packer was excluding all .so files, including ctypes libraries like libpdfium.so that aren't Python extensions. Now only files matching tagged EXTENSION_SUFFIXES (containing 'cpython' or 'abi3') are excluded. Plain .so/.dylib files are packed as resources. Fixes pypdfium2 on Linux where libpdfium.so was missing from the bundle. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bbfa648 commit d7d84f8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

paker/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,11 @@ def _pack_file(
769769
)
770770

771771

772-
_CODE_FILE_EXTS = frozenset({
773-
".py", ".pyc", ".pyo", ".pyd", ".so", ".dll",
774-
})
772+
_CODE_FILE_EXTS = frozenset({".py", ".pyc", ".pyo"})
773+
_NATIVE_EXT_PATTERNS = tuple(
774+
s for s in importlib.machinery.EXTENSION_SUFFIXES
775+
if "cpython" in s or "abi3" in s
776+
) + (".pyd",)
775777

776778

777779
def _pack_native_libs(
@@ -864,6 +866,8 @@ def _pack_resources(
864866
_, ext = os.path.splitext(name)
865867
if ext.lower() in _CODE_FILE_EXTS:
866868
continue
869+
if any(name.endswith(s) for s in _NATIVE_EXT_PATTERNS):
870+
continue
867871
src = os.path.join(root, name)
868872
rel = os.path.relpath(src, path_entry_abs).replace(os.sep, "/")
869873
if rel in seen:

0 commit comments

Comments
 (0)