From cb697804271e10113c459fd3cff31e06ab27a088 Mon Sep 17 00:00:00 2001 From: swnf <50806201+swnf@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:55:30 +0100 Subject: [PATCH 1/4] Set EM_PKG_CONFIG_PATH to correctly configure pkg-config --- pyodide_build/buildpkg.py | 6 +++++- pyodide_build/tests/test_buildpkg.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pyodide_build/buildpkg.py b/pyodide_build/buildpkg.py index 22d227b..6ad323b 100755 --- a/pyodide_build/buildpkg.py +++ b/pyodide_build/buildpkg.py @@ -549,7 +549,11 @@ def _get_helper_vars(self) -> dict[str, str]: "DISTDIR": str(self.src_dist_dir), # TODO: rename this to something more compatible with Makefile or CMake conventions "WASM_LIBRARY_DIR": str(self.library_install_prefix), - # Using PKG_CONFIG_LIBDIR instead of PKG_CONFIG_PATH, + # Emscripten will use this variable to configure pkg-config in emconfigure + "EM_PKG_CONFIG_PATH": str(self.library_install_prefix / "lib/pkgconfig"), + # This variable is usually overwritten by emconfigure + # The value below will only be used if pkg-config is called without emconfigure + # We use PKG_CONFIG_LIBDIR instead of PKG_CONFIG_PATH, # so pkg-config will not look in the default system directories "PKG_CONFIG_LIBDIR": str(self.library_install_prefix / "lib/pkgconfig"), } diff --git a/pyodide_build/tests/test_buildpkg.py b/pyodide_build/tests/test_buildpkg.py index c320c20..33b8a8f 100644 --- a/pyodide_build/tests/test_buildpkg.py +++ b/pyodide_build/tests/test_buildpkg.py @@ -126,6 +126,9 @@ def test_get_helper_vars(tmp_path): tmp_path / "pkg_1" / "build" / "pkg_1-1.0.0" / "dist" ) assert helper_vars["WASM_LIBRARY_DIR"] == str(tmp_path / ".libs") + assert helper_vars["EM_PKG_CONFIG_PATH"] == str( + tmp_path / ".libs" / "lib" / "pkgconfig" + ) assert helper_vars["PKG_CONFIG_LIBDIR"] == str( tmp_path / ".libs" / "lib" / "pkgconfig" ) From d0762805858b27e685d293cf3752e823e8970094 Mon Sep 17 00:00:00 2001 From: swnf <50806201+swnf@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:16:22 +0100 Subject: [PATCH 2/4] Fix source extract issues in CI pipeline --- pyodide_build/buildpkg.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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: From 83809fe8ff0f12cf19739b70d938f81219cf19df Mon Sep 17 00:00:00 2001 From: swnf <50806201+swnf@users.noreply.github.com> Date: Tue, 12 Nov 2024 21:23:05 +0100 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca59cba..898a960 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `skip_emscripten_version_check` flag and SKIP_EMSCRIPTEN_VERSION_CHECK environment variable to skip emscripten version check. [#53](https://github.com/pyodide/pyodide-build/pull/53) +- Set the `EM_PKG_CONFIG_PATH` environment variable used by emscripten/`pkg-config` to discover dependencies + [#52](https://github.com/pyodide/pyodide-build/pull/52) + +### Changed + +- Source tar files are now extracted with python's [data filter](https://docs.python.org/3/library/tarfile.html#tarfile.data_filter) + [#52](https://github.com/pyodide/pyodide-build/pull/52) ## [0.29.0] - 2024/09/19 From eee18343915db861a2ef0a96d64b2696b790cc30 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Wed, 27 Nov 2024 20:49:45 +0900 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daade50..d7e750c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.29.1] ### Added