refactor(internal): move the os/arch detection to repo_utils (#2075)
This also changes the local_runtime_repo to explicitly check for
supported platforms instead of relying on a `None` value returned by the
helper method. This makes the behaviour exactly the same to the
behaviour before this PR and we can potentially drop the need for the
validation in the future if our local_runtime detection is more robust.
This also makes the platform detectino in `pypi_repo_utils` not depend
on `uname` and only use the `repository_ctx`. Apparently the
`module_ctx.watch` throws an error if one attempts to watch files on the
system (this is left for `repository_rule` it seems and one can only do
`module_ctx.watch` on files within the current workspace. This was
surprising, but could have been worked around by just unifying code.
This splits out things from #2059 and makes the code more succinct.
Work towards #260, #1105, #1868.
diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl
index d837d8d..95526e4 100644
--- a/python/private/pypi/extension.bzl
+++ b/python/private/pypi/extension.bzl
@@ -199,7 +199,7 @@
logger = logger,
)
- repository_platform = host_platform(module_ctx.os)
+ repository_platform = host_platform(module_ctx)
for whl_name, requirements in requirements_by_platform.items():
# We are not using the "sanitized name" because the user
# would need to guess what name we modified the whl name