Skip to content

Commit

Permalink
Make build-recipes-no-deps do rust setup too
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Jan 15, 2025
1 parent 903cbcb commit 050e976
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pyodide_build/buildall.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def build(self, build_args: BuildArgs, build_dir: Path) -> None:
# been updated and should be rebuilt even though its own
# files haven't been updated.
"--force-rebuild",
# We already did the rust setup in buildall
"--skip-rust-setup",
],
check=False,
stdout=subprocess.DEVNULL,
Expand Down
18 changes: 17 additions & 1 deletion pyodide_build/cli/build_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import typer

from pyodide_build import build_env, buildall
from pyodide_build import build_env, buildall, recipe
from pyodide_build.build_env import BuildArgs, init_environment
from pyodide_build.buildpkg import RecipeBuilder
from pyodide_build.common import get_num_cores
Expand All @@ -17,6 +17,7 @@ class Args:
build_dir: Path
install_dir: Path
build_args: BuildArgs
skip_rust_setup: bool
force_rebuild: bool
n_jobs: int

Expand Down Expand Up @@ -93,6 +94,11 @@ def build_recipes_no_deps(
"--continue",
help="Continue a build from the middle. For debugging. Implies '--force-rebuild'",
),
skip_rust_setup: bool = typer.Option(
False,
"--skip-rust-setup",
help="Don't setup rust environment when building a rust package",
),
) -> None:
"""Build packages using yaml recipes but don't try to resolve dependencies"""
init_environment()
Expand All @@ -113,15 +119,25 @@ def build_recipes_no_deps(
build_dir=build_dir,
recipe_dir=recipe_dir,
force_rebuild=force_rebuild,
skip_rust_setup=skip_rust_setup,
)

return build_recipes_no_deps_impl(packages, args, continue_)


def _rust_setup(recipe_dir: Path, packages: list[str]):
recipes = recipe.load_recipes(recipe_dir, packages, False)
if any(recipe.is_rust_package() for recipe in recipes.values()):
buildall._ensure_rust_toolchain()


def build_recipes_no_deps_impl(
packages: list[str], args: Args, continue_: bool
) -> None:
# TODO: use multiprocessing?
if not args.skip_rust_setup:
_rust_setup(args.recipe_dir, packages)

for package in packages:
package_path = args.recipe_dir / package
package_build_dir = args.build_dir / package / "build"
Expand Down

0 comments on commit 050e976

Please sign in to comment.