Skip to content

Commit

Permalink
fallback option
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanking13 committed Jan 6, 2025
1 parent 09f86f9 commit 4abec96
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pyodide_build/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
Expand All @@ -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.
Expand All @@ -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)
Expand Down
14 changes: 10 additions & 4 deletions pyodide_build/pypabuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4abec96

Please sign in to comment.