Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python/private/pypi/parse_requirements.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ def _add_dists(*, requirement, index_urls, logger = None):
if requirement.srcs.url:
url = requirement.srcs.url
_, _, filename = url.rpartition("/")
if "." not in filename:
# detected filename has no extension, it might be an sdist ref
# TODO @aignas 2025-04-03: should be handled if the following is fixed:
# https://github.com/bazel-contrib/rules_python/issues/2363
return [], None

direct_url_dist = struct(
url = url,
filename = filename,
Expand Down
50 changes: 49 additions & 1 deletion tests/pypi/extension/extension_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ some_pkg==0.0.1 @ example-direct.org/some_pkg-0.0.1-py3-none-any.whl \
direct_without_sha==0.0.1 @ example-direct.org/direct_without_sha-0.0.1-py3-none-any.whl
some_other_pkg==0.0.1
pip_fallback==0.0.1
direct_sdist_without_sha @ some-archive/any-name.tar.gz
git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
""",
}[x],
),
Expand All @@ -672,10 +674,28 @@ pip_fallback==0.0.1
)

pypi.is_reproducible().equals(False)
pypi.exposed_packages().contains_exactly({"pypi": ["direct_without_sha", "pip_fallback", "simple", "some_other_pkg", "some_pkg"]})
pypi.exposed_packages().contains_exactly({"pypi": [
"direct_sdist_without_sha",
"direct_without_sha",
"git_dep",
"pip_fallback",
"simple",
"some_other_pkg",
"some_pkg",
]})
pypi.hub_group_map().contains_exactly({"pypi": {}})
pypi.hub_whl_map().contains_exactly({
"pypi": {
"direct_sdist_without_sha": {
"pypi_315_any_name": [
struct(
config_setting = None,
filename = "any-name.tar.gz",
target_platforms = None,
version = "3.15",
),
],
},
"direct_without_sha": {
"pypi_315_direct_without_sha_0_0_1_py3_none_any": [
struct(
Expand All @@ -686,6 +706,16 @@ pip_fallback==0.0.1
),
],
},
"git_dep": {
"pypi_315_git_dep": [
struct(
config_setting = None,
filename = None,
target_platforms = None,
version = "3.15",
),
],
},
"pip_fallback": {
"pypi_315_pip_fallback": [
struct(
Expand Down Expand Up @@ -737,6 +767,17 @@ pip_fallback==0.0.1
},
})
pypi.whl_libraries().contains_exactly({
"pypi_315_any_name": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": ["cp315_linux_aarch64", "cp315_linux_arm", "cp315_linux_ppc", "cp315_linux_s390x", "cp315_linux_x86_64", "cp315_osx_aarch64", "cp315_osx_x86_64", "cp315_windows_x86_64"],
"extra_pip_args": ["--extra-args-for-sdist-building"],
"filename": "any-name.tar.gz",
"python_interpreter_target": "unit_test_interpreter_target",
"repo": "pypi_315",
"requirement": "direct_sdist_without_sha @ some-archive/any-name.tar.gz",
"sha256": "",
"urls": ["some-archive/any-name.tar.gz"],
},
"pypi_315_direct_without_sha_0_0_1_py3_none_any": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": ["cp315_linux_aarch64", "cp315_linux_arm", "cp315_linux_ppc", "cp315_linux_s390x", "cp315_linux_x86_64", "cp315_osx_aarch64", "cp315_osx_x86_64", "cp315_windows_x86_64"],
Expand All @@ -747,6 +788,13 @@ pip_fallback==0.0.1
"sha256": "",
"urls": ["example-direct.org/direct_without_sha-0.0.1-py3-none-any.whl"],
},
"pypi_315_git_dep": {
"dep_template": "@pypi//{name}:{target}",
"extra_pip_args": ["--extra-args-for-sdist-building"],
"python_interpreter_target": "unit_test_interpreter_target",
"repo": "pypi_315",
"requirement": "git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef",
},
"pypi_315_pip_fallback": {
"dep_template": "@pypi//{name}:{target}",
"extra_pip_args": ["--extra-args-for-sdist-building"],
Expand Down