|
| 1 | +# Regression: pyproject.toml name = "rdflib-linux" (hyphens, standard Python convention) |
| 2 | +# causes uv_hub to emit config_setting(name = "rdflib-linux", ...) with the raw name. |
| 3 | +# A user writing dep_group = "rdflib_linux" (underscores, natural Bazel convention) |
| 4 | +# gets a mismatch: flag "rdflib_linux" ≠ config_setting "rdflib-linux", so |
| 5 | +# compatible_with() falls through to //conditions:default and emits |
| 6 | +# @@platforms//:incompatible for the entire rdflib alias. |
| 7 | +# |
| 8 | +# Fix: normalize dep_group names in uv_hub (replace "-" → "_") before emitting |
| 9 | +# config_setting targets and flag_values. |
| 10 | +load("@aspect_rules_py//py:defs.bzl", "py_test") |
| 11 | +load("@rules_shell//shell:sh_test.bzl", "sh_test") |
| 12 | + |
| 13 | +# This sh_test reads the hub's generated dep_group/BUILD.bazel via exports_files() |
| 14 | +# — a source-file target that carries NO target_compatible_with, so incompatibility |
| 15 | +# does NOT propagate here. The test runs in //... and FAILS while the bug exists. |
| 16 | +# |
| 17 | +# Root cause it checks: uv_hub emits config_setting(name = "rdflib-linux") using the |
| 18 | +# raw pyproject.toml [project].name. A user writing dep_group = "rdflib_linux" |
| 19 | +# (underscore, Bazel convention) gets no match → @@platforms//:incompatible. |
| 20 | +# Fix: normalize dep_group names with normalize_name() in uv_hub/repository.bzl. |
| 21 | +sh_test( |
| 22 | + name = "dep_group_names_normalized", |
| 23 | + srcs = ["check_dep_group_names.sh"], |
| 24 | + args = ["$(location @pypi_rdflib_linux//dep_group:BUILD.bazel)"], |
| 25 | + data = ["@pypi_rdflib_linux//dep_group:BUILD.bazel"], |
| 26 | + target_compatible_with = ["@platforms//os:linux"], |
| 27 | +) |
| 28 | + |
| 29 | +# Vector 1: hyphen/underscore mismatch. |
| 30 | +# pyproject.toml name = "rdflib-linux" → hub config_setting = "rdflib-linux". |
| 31 | +# dep_group = "rdflib_linux" (underscore) doesn't match → @@platforms//:incompatible. |
| 32 | +py_test( |
| 33 | + name = "rdflib_linux", |
| 34 | + srcs = ["__test__.py"], |
| 35 | + dep_group = "rdflib_linux", |
| 36 | + main = "__test__.py", |
| 37 | + python_version = "3.11", |
| 38 | + target_compatible_with = ["@platforms//os:linux"], |
| 39 | + deps = [ |
| 40 | + "@pypi_rdflib_linux//rdflib", |
| 41 | + ], |
| 42 | +) |
| 43 | + |
| 44 | +# Vector 2: multi-project hub, rdflib only in one project. |
| 45 | +# "other" project shares @pypi_rdflib_linux but has no rdflib dependency. |
| 46 | +# Building with dep_group = "other" → rdflib alias has no matching arm |
| 47 | +# for "other" → //conditions:default → @@platforms//:incompatible. |
| 48 | +py_test( |
| 49 | + name = "rdflib_wrong_dep_group", |
| 50 | + srcs = ["__test__.py"], |
| 51 | + dep_group = "other", |
| 52 | + main = "__test__.py", |
| 53 | + python_version = "3.11", |
| 54 | + target_compatible_with = ["@platforms//os:linux"], |
| 55 | + deps = [ |
| 56 | + "@pypi_rdflib_linux//rdflib", |
| 57 | + ], |
| 58 | +) |
0 commit comments