Skip to content

fix: use published PyPI source URL when shorthand fails - #2981

Open
pcbeingused33 wants to merge 1 commit into
prefix-dev:mainfrom
pcbeingused33:fix/pypi-sdist-source-url
Open

pcbeingused33 wants to merge 1 commit into
prefix-dev:mainfrom
pcbeingused33:fix/pypi-sdist-source-url

Conversation

@pcbeingused33

Copy link
Copy Markdown
Contributor

generate-recipe pypi can emit a shorthand source URL that returns 404 even though PyPI lists a downloadable source distribution. For example, the shorthand URL generated for PyYAML 5.3.1 returns 404. The HEAD request completes successfully at the transport level, so checking only the request result accepts the 404 response.

Use the shorthand URL only when HEAD returns a 2xx status. Otherwise, keep the source distribution URL published in the package metadata.

Testing

The regression test serves HEAD responses from a local HTTP server and checks that a 404 selects the published URL and a 200 keeps the shorthand URL.

cargo test --locked -p rattler_build_recipe_generator pypi::tests::test_source_url_requires_successful_head -- --exact

AI assistance was used to prepare this change and its regression test.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant