diff --git a/pyodide_build/buildpkg.py b/pyodide_build/buildpkg.py index 6ad323b..9e650a6 100755 --- a/pyodide_build/buildpkg.py +++ b/pyodide_build/buildpkg.py @@ -11,7 +11,6 @@ import shutil import subprocess import sys -import warnings from collections.abc import Iterator from datetime import datetime from pathlib import Path @@ -349,12 +348,18 @@ def _download_and_extract(self) -> None: shutil.copy(tarballpath, self.src_dist_dir) return - with warnings.catch_warnings(): - # Python 3.12-3.13 emits a DeprecationWarning when using shutil.unpack_archive without a filter, - # but filter doesn't work well for zip files, so we suppress the warning until we find a better solution. - # https://github.com/python/cpython/issues/112760 - warnings.simplefilter("ignore") - shutil.unpack_archive(tarballpath, self.build_dir) + # Use a Python 3.14-like filter (see https://github.com/python/cpython/issues/112760) + # Can be removed once we use Python 3.14 + # The "data" filter will reset ownership but preserve permissions and modification times + # Without it, permissions and modification times will be silently skipped if the uid/git + # is too large for the chown() call. This behavior can lead to "Permission denied" errors + # (missing x bit) or random strange `make` behavior (due to wrong mtime order) in the CI + # pipeline. + shutil.unpack_archive( + tarballpath, + self.build_dir, + filter=None if tarballpath.suffix == ".zip" else "data", + ) extract_dir_name = self.source_metadata.extract_dir if extract_dir_name is None: