Skip to content

Refactor(bootstrapper): add force_prebuilt flag, remove _handle_test_mode_failure#894

Open
LalatenduMohanty wants to merge 1 commit intopython-wheel-build:mainfrom
LalatenduMohanty:test-mode-cleanup-2
Open

Refactor(bootstrapper): add force_prebuilt flag, remove _handle_test_mode_failure#894
LalatenduMohanty wants to merge 1 commit intopython-wheel-build:mainfrom
LalatenduMohanty:test-mode-cleanup-2

Conversation

@LalatenduMohanty
Copy link
Member

@LalatenduMohanty LalatenduMohanty commented Dec 19, 2025

Move test-mode prebuilt fallback from _build_from_source into bootstrap().

On build failure, bootstrap() now records the error and retries via
_bootstrap_impl(force_prebuilt=True), which resolves and downloads a
pre-built wheel internally. This removes _handle_test_mode_failure and
the req_type parameter from _build_from_source.

Also added tests for prebuilt fallback path in bootstrap()

Closes #892 , Depends on #893

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner December 19, 2025 19:37
@mergify mergify bot added the ci label Dec 19, 2025
@LalatenduMohanty LalatenduMohanty force-pushed the test-mode-cleanup-2 branch 3 times, most recently from 17aef1b to f31d17c Compare December 19, 2025 20:11
build_error,
)
try:
wheel_url, fallback_version = self._resolve_prebuilt_with_history(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need to resolve again, we have the version we want, we should just be able to call _bootstrap_impl again with the force flag set to true.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it

fallback_error,
exc_info=True,
)
# Record the original build error, not the fallback error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to record the original error even if the fallback is successful. We could also record the fallback error, as additional information, because it would be useful to know that we weren't able to do anything at all for the package.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have changed the code as per your suggestion.

@LalatenduMohanty LalatenduMohanty force-pushed the test-mode-cleanup-2 branch 3 times, most recently from 3ffb492 to 3d7eb22 Compare March 14, 2026 16:38
…prebuilt flag

Move test-mode prebuilt fallback from _build_from_source into bootstrap().
On build failure, bootstrap() now records the error and retries via
_bootstrap_impl(force_prebuilt=True), which resolves and downloads a
pre-built wheel internally. This removes _handle_test_mode_failure and
the req_type parameter from _build_from_source.

Closes: python-wheel-build#892

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean ups in --test-mode code

2 participants