| load("@rules_python//python:py_binary.bzl", "py_binary") | |
| load("@rules_python//python:py_test.bzl", "py_test") | |
| exports_files([ | |
| "storage_pkg-1.0-py3-none-any.whl", | |
| "wheel.sha256", | |
| "modify_pkg.patch", | |
| "uv.lock", | |
| ]) | |
| [ | |
| py_binary( | |
| name = name, | |
| srcs = ["main.py"], | |
| legacy_create_init = 0, | |
| main = "main.py", | |
| deps = ["@{}//:pkg".format(name)], | |
| ) | |
| for name in [ | |
| "plain", | |
| "patched", | |
| "nonmatching", | |
| "provided", | |
| "provided_patched", | |
| ] | |
| ] | |
| py_binary( | |
| name = "uv_locked", | |
| srcs = ["main.py"], | |
| legacy_create_init = 0, | |
| main = "main.py", | |
| deps = ["@uv_pip//storage_pkg"], | |
| ) | |
| [ | |
| alias( | |
| name = "{}_pkg".format(pkg), | |
| actual = "@rules_python//python:none", | |
| ) | |
| for pkg in [ | |
| "charset_normalizer", | |
| "certifi", | |
| "idna", | |
| "urllib3", | |
| ] | |
| ] | |
| [ | |
| filegroup( | |
| name = "{}_whl".format(pkg), | |
| srcs = [], | |
| visibility = ["//visibility:public"], | |
| ) | |
| for pkg in [ | |
| "charset_normalizer", | |
| "certifi", | |
| "idna", | |
| "urllib3", | |
| ] | |
| ] | |
| # Extract all deps | |
| genquery( | |
| name = "whl_target_deps", | |
| expression = "deps(@whl_archive//:pkg)", | |
| scope = ["@whl_archive//:pkg"], | |
| ) | |
| # Extract all deps | |
| genquery( | |
| name = "whl_deps_target_deps", | |
| expression = "deps(@whl_deps_repo//:pkg)", | |
| scope = ["@whl_deps_repo//:pkg"], | |
| ) | |
| py_test( | |
| name = "test_contents", | |
| srcs = ["test_contents.py"], | |
| data = [ | |
| ":whl_deps_target_deps", | |
| ":whl_target_deps", | |
| "@pip_archive//:srcs", | |
| "@pip_sdist_archive//:srcs", | |
| "@whl_archive//:srcs", | |
| "@whl_archive//:whl", | |
| "@whl_deps_repo//:whl", | |
| ], | |
| env = { | |
| "SDIST_SRC_FILES": "$(locations @pip_sdist_archive//:srcs)", | |
| "SRC_FILES": "$(locations @pip_archive//:srcs)", | |
| "WHL_DEPS": "$(location :whl_target_deps)", | |
| "WHL_DEPS_LOCATION": "$(location @whl_deps_repo//:whl)", | |
| "WHL_FILES": "$(locations @whl_archive//:srcs)", | |
| "WHL_LOCATION": "$(location @whl_archive//:whl)", | |
| "WHL_TARGET_DEPS": "$(location :whl_deps_target_deps)", | |
| }, | |
| ) |