From 580d74d8294d96d3f6e8a7fa1d568ca42e7a0785 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 2 Dec 2024 08:55:45 +0000 Subject: [PATCH 01/15] wip [integration] --- pyodide_build/common.py | 33 ++++++++++++++++++++++++++++ pyodide_build/pypabuild.py | 45 ++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/pyodide_build/common.py b/pyodide_build/common.py index 2f930704..57b3dd6f 100644 --- a/pyodide_build/common.py +++ b/pyodide_build/common.py @@ -447,3 +447,36 @@ def to_bool(value: str) -> bool: Convert a string to a boolean value. Useful for parsing environment variables. """ return value.lower() not in {"", "0", "false", "no", "off"} + + +def get_host_platform(): + """ + Return a string that identifies the current platform. + Simplified version of get_host_platform in pypa/distlib. + """ + if os.name != "posix": + raise ValueError(f"only posix platforms are supported, got {os.name}") + + # Set for cross builds explicitly + if "_PYTHON_HOST_PLATFORM" in os.environ: + return os.environ["_PYTHON_HOST_PLATFORM"] + + + # Try to distinguish various flavours of Unix + (osname, host, release, version, machine) = os.uname() + + # Convert the OS name to lowercase, remove '/' characters, and translate + # spaces (for "Power Macintosh") + osname = osname.lower().replace('/', '') + machine = machine.replace(' ', '_').replace('/', '-') + + if osname[:5] == 'linux': + return f"{osname}-{machine}" + elif osname[:6] == 'darwin': + import _osx_support + import sysconfig + osname, release, machine = _osx_support.get_platform_osx(sysconfig.get_config_vars(), osname, release, machine) + else: + raise ValueError(f"unsupported os: {osname}") + + return f"{osname}-{release}-{machine}" diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index c72574ea..65245eda 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -4,7 +4,7 @@ import subprocess as sp import sys import traceback -from collections.abc import Callable, Iterator, Mapping, Sequence +from collections.abc import Callable, Generator, Iterator, Mapping, Sequence from contextlib import contextmanager from itertools import chain from pathlib import Path @@ -54,6 +54,8 @@ "gfortran": "FC", # https://mesonbuild.com/Reference-tables.html#compiler-and-linker-selection-variables } +HOST_ARCH = common.get_host_platform().replace('-', '_').replace('.', '_') + def _gen_runner( cross_build_env: Mapping[str, str], @@ -127,7 +129,8 @@ def install_reqs(env: DefaultIsolatedEnv, reqs: set[str]) -> None: env.install( remove_avoided_requirements( reqs, - get_unisolated_packages() + AVOIDED_REQUIREMENTS, + # get_unisolated_packages() + AVOIDED_REQUIREMENTS, + AVOIDED_REQUIREMENTS, ) ) @@ -153,8 +156,19 @@ def _build_in_isolated_env( # first install the build dependencies symlink_unisolated_packages(env) - install_reqs(env, builder.build_system_requires) - installed_requires_for_build = False + index_url_for_cross_build = get_build_flag("BUILD_DEPENDENCY_INDEX_URL") + installed_build_system_requires = False + with switch_index_url(index_url_for_cross_build): + try: + install_reqs(env, builder.build_system_requires) + installed_build_system_requires = True + except Exception: + print(f"Failed to install build dependencies from {index_url_for_cross_build}, falling back to default index url") + + # Disabled for testing + # if not installed_build_system_requires: + # install_reqs(env, builder.build_system_requires) + try: build_reqs = builder.get_requires_for_build( distribution, @@ -242,6 +256,29 @@ def make_command_wrapper_symlinks(symlink_dir: Path) -> dict[str, str]: return env +@contextmanager +def switch_index_url(index_url: str) -> Generator[None, None, None]: + """ + Switch index URL that pip locates the packages. + This function is expected to be used during the process of + installing package build dependencies. + + Parameters + ---------- + index_url: index URL to switch to + """ + + env = { + "PIP_INDEX_URL": index_url, + "PIP_PLATFORM": " ".join([ + f"pyodide_{get_build_flag("PYODIDE_ABI_VERSION")}_wasm32", + HOST_ARCH, + ]), + } + + return common.replace_env(env) + + @contextmanager def get_build_env( env: dict[str, str], From dd81f55970adf6e84bd8b7a4777c6362c74a9820 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 2 Dec 2024 13:24:40 +0000 Subject: [PATCH 02/15] yield [integration] --- pyodide_build/pypabuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index 65245eda..0cf51ad4 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -276,7 +276,7 @@ def switch_index_url(index_url: str) -> Generator[None, None, None]: ]), } - return common.replace_env(env) + yield common.replace_env(env) @contextmanager From d0bb439e8f5aa5be0676c79ca22da05d391e037e Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 2 Dec 2024 14:06:59 +0000 Subject: [PATCH 03/15] Use hostsitepackages --- pyodide_build/build_env.py | 19 ------------------- pyodide_build/buildpkg.py | 10 ++-------- pyodide_build/pypabuild.py | 8 -------- pyodide_build/tests/conftest.py | 1 - 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/pyodide_build/build_env.py b/pyodide_build/build_env.py index eeaca3a4..3d219d82 100644 --- a/pyodide_build/build_env.py +++ b/pyodide_build/build_env.py @@ -170,25 +170,6 @@ def get_hostsitepackages() -> str: return get_build_flag("HOSTSITEPACKAGES") -@functools.cache -def get_unisolated_packages() -> list[str]: - PYODIDE_ROOT = get_pyodide_root() - - unisolated_file = PYODIDE_ROOT / "unisolated.txt" - if unisolated_file.exists(): - # in xbuild env, read from file - unisolated_packages = unisolated_file.read_text().splitlines() - else: - unisolated_packages = [] - recipe_dir = PYODIDE_ROOT / "packages" - recipes = load_all_recipes(recipe_dir) - for name, config in recipes.items(): - if config.build.cross_build_env: - unisolated_packages.append(name) - - return unisolated_packages - - def platform() -> str: emscripten_version = get_build_flag("PYODIDE_EMSCRIPTEN_VERSION") version = emscripten_version.replace(".", "_") diff --git a/pyodide_build/buildpkg.py b/pyodide_build/buildpkg.py index 0567f511..b95ebe88 100755 --- a/pyodide_build/buildpkg.py +++ b/pyodide_build/buildpkg.py @@ -473,15 +473,9 @@ def _package_wheel( / f"lib/{python_dir}/site-packages" ) if self.build_metadata.cross_build_env: - subprocess.run( - ["pip", "install", "-t", str(host_site_packages), f"{name}=={ver}"], - check=True, - ) - - for cross_build_file in self.build_metadata.cross_build_files: shutil.copy( - (wheel_dir / cross_build_file), - host_site_packages / cross_build_file, + wheel_dir, + host_site_packages, ) try: diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index 0cf51ad4..f3b1606d 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -105,13 +105,6 @@ def symlink_unisolated_packages(env: DefaultIsolatedEnv) -> None: env_site_packages.mkdir(parents=True, exist_ok=True) shutil.copy(sysconfigdata_path, env_site_packages) - host_site_packages = Path(get_hostsitepackages()) - for name in get_unisolated_packages(): - for path in chain( - host_site_packages.glob(f"{name}*"), host_site_packages.glob(f"_{name}*") - ): - (env_site_packages / path.name).unlink(missing_ok=True) - (env_site_packages / path.name).symlink_to(path) def remove_avoided_requirements( @@ -129,7 +122,6 @@ def install_reqs(env: DefaultIsolatedEnv, reqs: set[str]) -> None: env.install( remove_avoided_requirements( reqs, - # get_unisolated_packages() + AVOIDED_REQUIREMENTS, AVOIDED_REQUIREMENTS, ) ) diff --git a/pyodide_build/tests/conftest.py b/pyodide_build/tests/conftest.py index 2a504831..ddc3b28c 100644 --- a/pyodide_build/tests/conftest.py +++ b/pyodide_build/tests/conftest.py @@ -62,7 +62,6 @@ def reset_cache(): def _reset(): build_env.get_pyodide_root.cache_clear() build_env.get_build_environment_vars.cache_clear() - build_env.get_unisolated_packages.cache_clear() _reset() From 4672c119d386f88ed089b9fc89071bc5f82475af Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:12:07 +0000 Subject: [PATCH 04/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyodide_build/build_env.py | 1 - pyodide_build/common.py | 14 ++++++++------ pyodide_build/pypabuild.py | 19 ++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pyodide_build/build_env.py b/pyodide_build/build_env.py index 3d219d82..31c1c23f 100644 --- a/pyodide_build/build_env.py +++ b/pyodide_build/build_env.py @@ -16,7 +16,6 @@ from pyodide_build import __version__ from pyodide_build.common import search_pyproject_toml, to_bool, xbuildenv_dirname from pyodide_build.config import ConfigManager -from pyodide_build.recipe import load_all_recipes RUST_BUILD_PRELUDE = """ rustup toolchain install ${RUST_TOOLCHAIN} && rustup default ${RUST_TOOLCHAIN} diff --git a/pyodide_build/common.py b/pyodide_build/common.py index 57b3dd6f..0113a989 100644 --- a/pyodide_build/common.py +++ b/pyodide_build/common.py @@ -461,21 +461,23 @@ def get_host_platform(): if "_PYTHON_HOST_PLATFORM" in os.environ: return os.environ["_PYTHON_HOST_PLATFORM"] - # Try to distinguish various flavours of Unix (osname, host, release, version, machine) = os.uname() # Convert the OS name to lowercase, remove '/' characters, and translate # spaces (for "Power Macintosh") - osname = osname.lower().replace('/', '') - machine = machine.replace(' ', '_').replace('/', '-') + osname = osname.lower().replace("/", "") + machine = machine.replace(" ", "_").replace("/", "-") - if osname[:5] == 'linux': + if osname[:5] == "linux": return f"{osname}-{machine}" - elif osname[:6] == 'darwin': + elif osname[:6] == "darwin": import _osx_support import sysconfig - osname, release, machine = _osx_support.get_platform_osx(sysconfig.get_config_vars(), osname, release, machine) + + osname, release, machine = _osx_support.get_platform_osx( + sysconfig.get_config_vars(), osname, release, machine + ) else: raise ValueError(f"unsupported os: {osname}") diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index f3b1606d..164cb8c6 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -6,7 +6,6 @@ import traceback from collections.abc import Callable, Generator, Iterator, Mapping, Sequence from contextlib import contextmanager -from itertools import chain from pathlib import Path from tempfile import TemporaryDirectory from typing import Literal, cast @@ -18,9 +17,7 @@ from pyodide_build import _f2c_fixes, common, pywasmcross from pyodide_build.build_env import ( get_build_flag, - get_hostsitepackages, get_pyversion, - get_unisolated_packages, platform, ) from pyodide_build.io import _BuildSpecExports @@ -54,7 +51,7 @@ "gfortran": "FC", # https://mesonbuild.com/Reference-tables.html#compiler-and-linker-selection-variables } -HOST_ARCH = common.get_host_platform().replace('-', '_').replace('.', '_') +HOST_ARCH = common.get_host_platform().replace("-", "_").replace(".", "_") def _gen_runner( @@ -155,7 +152,9 @@ def _build_in_isolated_env( install_reqs(env, builder.build_system_requires) installed_build_system_requires = True except Exception: - print(f"Failed to install build dependencies from {index_url_for_cross_build}, falling back to default index url") + print( + f"Failed to install build dependencies from {index_url_for_cross_build}, falling back to default index url" + ) # Disabled for testing # if not installed_build_system_requires: @@ -262,10 +261,12 @@ def switch_index_url(index_url: str) -> Generator[None, None, None]: env = { "PIP_INDEX_URL": index_url, - "PIP_PLATFORM": " ".join([ - f"pyodide_{get_build_flag("PYODIDE_ABI_VERSION")}_wasm32", - HOST_ARCH, - ]), + "PIP_PLATFORM": " ".join( + [ + f"pyodide_{get_build_flag("PYODIDE_ABI_VERSION")}_wasm32", + HOST_ARCH, + ] + ), } yield common.replace_env(env) From 97a399aff1e4210c65f74b5a2d0e36060ac5267c Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 23 Dec 2024 05:28:43 +0000 Subject: [PATCH 05/15] Fix undefined var --- pyodide_build/pypabuild.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index 164cb8c6..fc191ea8 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -146,7 +146,9 @@ def _build_in_isolated_env( # first install the build dependencies symlink_unisolated_packages(env) index_url_for_cross_build = get_build_flag("BUILD_DEPENDENCY_INDEX_URL") - installed_build_system_requires = False + installed_build_system_requires = False # build depdency for in pyproject.toml + installed_backend_requires = False # dependencies defined by the backend for a given distribution + with switch_index_url(index_url_for_cross_build): try: install_reqs(env, builder.build_system_requires) @@ -168,10 +170,10 @@ def _build_in_isolated_env( pass else: install_reqs(env, build_reqs) - installed_requires_for_build = True + installed_backend_requires = True with common.replace_env(build_env): - if not installed_requires_for_build: + if not installed_backend_requires: build_reqs = builder.get_requires_for_build( distribution, config_settings, From d0a020bb14e50aa90700d3349d6073aca2c84cf0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 05:28:54 +0000 Subject: [PATCH 06/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyodide_build/pypabuild.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index fc191ea8..12de1168 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -147,7 +147,9 @@ def _build_in_isolated_env( symlink_unisolated_packages(env) index_url_for_cross_build = get_build_flag("BUILD_DEPENDENCY_INDEX_URL") installed_build_system_requires = False # build depdency for in pyproject.toml - installed_backend_requires = False # dependencies defined by the backend for a given distribution + installed_backend_requires = ( + False # dependencies defined by the backend for a given distribution + ) with switch_index_url(index_url_for_cross_build): try: From 8f95de3fdc8a89d8637860526664725a613fe1f8 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 23 Dec 2024 07:36:37 +0000 Subject: [PATCH 07/15] copytree --- pyodide_build/buildpkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyodide_build/buildpkg.py b/pyodide_build/buildpkg.py index 15538ee8..59258a8c 100755 --- a/pyodide_build/buildpkg.py +++ b/pyodide_build/buildpkg.py @@ -537,7 +537,7 @@ def _package_wheel( / f"lib/{python_dir}/site-packages" ) if self.build_metadata.cross_build_env: - shutil.copy( + shutil.copytree( wheel_dir, host_site_packages, ) From 1ed547b70f9f020e2838a65cc5abb38044921f54 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 6 Jan 2025 13:06:22 +0000 Subject: [PATCH 08/15] Update index url --- pyodide_build/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyodide_build/config.py b/pyodide_build/config.py index 89cdc809..270a4d4b 100644 --- a/pyodide_build/config.py +++ b/pyodide_build/config.py @@ -211,7 +211,7 @@ def to_env(self) -> dict[str, str]: # Other configuration "pyodide_jobs": "1", "skip_emscripten_version_check": "0", - "build_dependency_index_url": "https://pypi.anaconda.org/pyodide/simple", + "build_dependency_index_url": "https://pypi.anaconda.org/pyodide-build/simple", # maintainer only "_f2c_fixes_wrapper": "", } From 7520b9b5790c0547779cac5ba49036aef3f2179a Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 6 Jan 2025 13:09:23 +0000 Subject: [PATCH 09/15] Fix env --- pyodide_build/pypabuild.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index 12de1168..57e60c31 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -273,7 +273,8 @@ def switch_index_url(index_url: str) -> Generator[None, None, None]: ), } - yield common.replace_env(env) + with common.replace_env(env) as replaced_env: + yield replaced_env @contextmanager @@ -310,6 +311,7 @@ def get_build_env( env.update(make_command_wrapper_symlinks(symlink_dir)) sysconfig_dir = Path(get_build_flag("TARGETINSTALLDIR")) / "sysconfigdata" + host_pythonpath = Path(get_build_flag("PYTHONPATH")) args["PYTHONPATH"] = sys.path + [str(symlink_dir), str(sysconfig_dir)] args["orig__name__"] = __name__ args["pythoninclude"] = get_build_flag("PYTHONINCLUDE") @@ -324,7 +326,7 @@ def get_build_env( env["_PYTHON_HOST_PLATFORM"] = platform() env["_PYTHON_SYSCONFIGDATA_NAME"] = get_build_flag("SYSCONFIG_NAME") - env["PYTHONPATH"] = str(sysconfig_dir) + env["PYTHONPATH"] = str(sysconfig_dir) + ":" + str(host_pythonpath) env["COMPILER_WRAPPER_DIR"] = str(symlink_dir) yield env From 6683a1bff854bc25429cbdb0a0194ac8f9411c6c Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 6 Jan 2025 14:06:02 +0000 Subject: [PATCH 10/15] don't set platform --- pyodide_build/pypabuild.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index 57e60c31..8a09f4e2 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -265,14 +265,16 @@ def switch_index_url(index_url: str) -> Generator[None, None, None]: env = { "PIP_INDEX_URL": index_url, - "PIP_PLATFORM": " ".join( - [ - f"pyodide_{get_build_flag("PYODIDE_ABI_VERSION")}_wasm32", - HOST_ARCH, - ] - ), } + # import build + # build._ctx.VERBOSITY.set(1) + + # def log(msg, *args, **kwargs): + # print(msg, str(kwargs)) + + # build._ctx.LOGGER.set(log) + with common.replace_env(env) as replaced_env: yield replaced_env From 09f86f93123a98d740a7121e39b84cd60062c2b0 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 6 Jan 2025 14:10:15 +0000 Subject: [PATCH 11/15] log --- pyodide_build/pypabuild.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index 8a09f4e2..eb6ac6f2 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -267,6 +267,7 @@ def switch_index_url(index_url: str) -> Generator[None, None, None]: "PIP_INDEX_URL": index_url, } + # For debugging: uncomment the lines below to see the pip error during the package installation # import build # build._ctx.VERBOSITY.set(1) From 4abec964acb40aa6a6334370bd875b92025b06ca Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 6 Jan 2025 14:34:54 +0000 Subject: [PATCH 12/15] fallback option --- pyodide_build/config.py | 3 +++ pyodide_build/pypabuild.py | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pyodide_build/config.py b/pyodide_build/config.py index 270a4d4b..932ee57a 100644 --- a/pyodide_build/config.py +++ b/pyodide_build/config.py @@ -179,6 +179,7 @@ def to_env(self) -> dict[str, str]: "build_dependency_index_url": "BUILD_DEPENDENCY_INDEX_URL", # maintainer only "_f2c_fixes_wrapper": "_F2C_FIXES_WRAPPER", + "_build_dependency_fallback_to_pypi": "BUILD_DEPENDENCY_FALLBACK_TO_PYPI", } BUILD_VAR_TO_KEY = {v: k for k, v in BUILD_KEY_TO_VAR.items()} @@ -195,6 +196,7 @@ def to_env(self) -> dict[str, str]: "build_dependency_index_url", # maintainer only "_f2c_fixes_wrapper", + "_build_dependency_fallback_to_pypi", } # Default configuration values. @@ -214,6 +216,7 @@ def to_env(self) -> dict[str, str]: "build_dependency_index_url": "https://pypi.anaconda.org/pyodide-build/simple", # maintainer only "_f2c_fixes_wrapper": "", + "_build_dependency_fallback_to_pypi": "1", } # Default configs that are computed from other values (often from Makefile.envs) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index eb6ac6f2..30dada42 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -156,13 +156,19 @@ def _build_in_isolated_env( install_reqs(env, builder.build_system_requires) installed_build_system_requires = True except Exception: + pass + + # Disabled for testing + if not installed_build_system_requires: + if common.to_bool(get_build_flag("BUILD_DEPENDENCY_FALLBACK_TO_PYPI")): print( f"Failed to install build dependencies from {index_url_for_cross_build}, falling back to default index url" ) - - # Disabled for testing - # if not installed_build_system_requires: - # install_reqs(env, builder.build_system_requires) + install_reqs(env, builder.build_system_requires) + else: + print( + f"Failed to install build dependencies from {index_url_for_cross_build}, proceeding the build, but it will fail." + ) try: build_reqs = builder.get_requires_for_build( From aa421d617ed4c07e746343b36e79c0953a591cee Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 6 Jan 2025 14:54:36 +0000 Subject: [PATCH 13/15] install native package --- pyodide_build/buildpkg.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pyodide_build/buildpkg.py b/pyodide_build/buildpkg.py index 59258a8c..9bf1a4d4 100755 --- a/pyodide_build/buildpkg.py +++ b/pyodide_build/buildpkg.py @@ -537,9 +537,15 @@ def _package_wheel( / f"lib/{python_dir}/site-packages" ) if self.build_metadata.cross_build_env: - shutil.copytree( - wheel_dir, - host_site_packages, + subprocess.run( + ["pip", "install", "-t", str(host_site_packages), f"{name}=={ver}"], + check=True, + ) + + for cross_build_file in self.build_metadata.cross_build_files: + shutil.copy( + (wheel_dir / cross_build_file), + host_site_packages / cross_build_file, ) try: From 99a1d7f227285cc2a878fb4cf6f12f370c227d96 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 16 Jan 2025 08:16:14 +0000 Subject: [PATCH 14/15] typo --- pyodide_build/pypabuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index 30dada42..b27bfa7b 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -146,7 +146,7 @@ def _build_in_isolated_env( # first install the build dependencies symlink_unisolated_packages(env) index_url_for_cross_build = get_build_flag("BUILD_DEPENDENCY_INDEX_URL") - installed_build_system_requires = False # build depdency for in pyproject.toml + installed_build_system_requires = False # build dependency for in pyproject.toml installed_backend_requires = ( False # dependencies defined by the backend for a given distribution ) From b696959cc627ddd51e2f46d72399c9d4068c4677 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 08:18:32 +0000 Subject: [PATCH 15/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyodide_build/pypabuild.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyodide_build/pypabuild.py b/pyodide_build/pypabuild.py index b27bfa7b..494c1a87 100644 --- a/pyodide_build/pypabuild.py +++ b/pyodide_build/pypabuild.py @@ -146,7 +146,9 @@ def _build_in_isolated_env( # first install the build dependencies symlink_unisolated_packages(env) index_url_for_cross_build = get_build_flag("BUILD_DEPENDENCY_INDEX_URL") - installed_build_system_requires = False # build dependency for in pyproject.toml + installed_build_system_requires = ( + False # build dependency for in pyproject.toml + ) installed_backend_requires = ( False # dependencies defined by the backend for a given distribution )