|
31 | 31 | load(":repo_utils.bzl", "REPO_DEBUG_ENV_VAR", "repo_utils") |
32 | 32 | load(":text_util.bzl", "render") |
33 | 33 |
|
34 | | -def get_repository_name(repository_workspace): |
35 | | - dummy_label = "//:_" |
36 | | - return str(repository_workspace.relative(dummy_label))[:-len(dummy_label)] or "@" |
37 | | - |
38 | 34 | def python_toolchain_build_file_content( |
39 | 35 | prefix, |
40 | 36 | python_version, |
@@ -90,10 +86,10 @@ def _toolchains_repo_impl(rctx): |
90 | 86 | # python_register_toolchains macro so you don't normally need to interact with |
91 | 87 | # these targets. |
92 | 88 |
|
93 | | -load("@{rules_python}//python/private:py_toolchain_suite.bzl", "py_toolchain_suite") |
| 89 | +load("@@{rules_python}//python/private:py_toolchain_suite.bzl", "py_toolchain_suite") |
94 | 90 |
|
95 | 91 | """.format( |
96 | | - rules_python = rctx.attr._rules_python_workspace.workspace_name, |
| 92 | + rules_python = rctx.attr._rules_python_workspace.repo_name, |
97 | 93 | ) |
98 | 94 |
|
99 | 95 | toolchains = python_toolchain_build_file_content( |
@@ -151,13 +147,13 @@ toolchain_aliases( |
151 | 147 | rctx.file("defs.bzl", content = """\ |
152 | 148 | # Generated by python/private/toolchains_repo.bzl |
153 | 149 |
|
154 | | -load("{rules_python}//python:pip.bzl", _compile_pip_requirements = "compile_pip_requirements") |
155 | | -load("{rules_python}//python/private:deprecation.bzl", "with_deprecation") |
156 | | -load("{rules_python}//python/private:text_util.bzl", "render") |
157 | | -load("{rules_python}//python:py_binary.bzl", _py_binary = "py_binary") |
158 | | -load("{rules_python}//python:py_test.bzl", _py_test = "py_test") |
| 150 | +load("@@{rules_python}//python:pip.bzl", _compile_pip_requirements = "compile_pip_requirements") |
| 151 | +load("@@{rules_python}//python/private:deprecation.bzl", "with_deprecation") |
| 152 | +load("@@{rules_python}//python/private:text_util.bzl", "render") |
| 153 | +load("@@{rules_python}//python:py_binary.bzl", _py_binary = "py_binary") |
| 154 | +load("@@{rules_python}//python:py_test.bzl", _py_test = "py_test") |
159 | 155 | load( |
160 | | - "{rules_python}//python/entry_points:py_console_script_binary.bzl", |
| 156 | + "@@{rules_python}//python/entry_points:py_console_script_binary.bzl", |
161 | 157 | _py_console_script_binary = "py_console_script_binary", |
162 | 158 | ) |
163 | 159 |
|
@@ -185,7 +181,7 @@ def compile_pip_requirements(**kwargs): |
185 | 181 | """.format( |
186 | 182 | name = rctx.attr.name, |
187 | 183 | python_version = rctx.attr.python_version, |
188 | | - rules_python = get_repository_name(rctx.attr._rules_python_workspace), |
| 184 | + rules_python = rctx.attr._rules_python_workspace.repo_name, |
189 | 185 | )) |
190 | 186 |
|
191 | 187 | toolchain_aliases = repository_rule( |
@@ -301,20 +297,20 @@ this repo causes an eager fetch of the toolchain for the host platform. |
301 | 297 | ) |
302 | 298 |
|
303 | 299 | def _multi_toolchain_aliases_impl(rctx): |
304 | | - rules_python = rctx.attr._rules_python_workspace.workspace_name |
| 300 | + rules_python = rctx.attr._rules_python_workspace.repo_name |
305 | 301 |
|
306 | 302 | for python_version, repository_name in rctx.attr.python_versions.items(): |
307 | 303 | file = "{}/defs.bzl".format(python_version) |
308 | 304 | rctx.file(file, content = """\ |
309 | 305 | # Generated by python/private/toolchains_repo.bzl |
310 | 306 |
|
311 | | -load("{rules_python}//python:pip.bzl", _compile_pip_requirements = "compile_pip_requirements") |
312 | | -load("{rules_python}//python/private:deprecation.bzl", "with_deprecation") |
313 | | -load("{rules_python}//python/private:text_util.bzl", "render") |
314 | | -load("{rules_python}//python:py_binary.bzl", _py_binary = "py_binary") |
315 | | -load("{rules_python}//python:py_test.bzl", _py_test = "py_test") |
| 307 | +load("@@{rules_python}//python:pip.bzl", _compile_pip_requirements = "compile_pip_requirements") |
| 308 | +load("@@{rules_python}//python/private:deprecation.bzl", "with_deprecation") |
| 309 | +load("@@{rules_python}//python/private:text_util.bzl", "render") |
| 310 | +load("@@{rules_python}//python:py_binary.bzl", _py_binary = "py_binary") |
| 311 | +load("@@{rules_python}//python:py_test.bzl", _py_test = "py_test") |
316 | 312 | load( |
317 | | - "{rules_python}//python/entry_points:py_console_script_binary.bzl", |
| 313 | + "@@{rules_python}//python/entry_points:py_console_script_binary.bzl", |
318 | 314 | _py_console_script_binary = "py_console_script_binary", |
319 | 315 | ) |
320 | 316 |
|
@@ -343,14 +339,14 @@ def compile_pip_requirements(**kwargs): |
343 | 339 | repository_name = repository_name, |
344 | 340 | name = rctx.attr.name, |
345 | 341 | python_version = python_version, |
346 | | - rules_python = get_repository_name(rctx.attr._rules_python_workspace), |
| 342 | + rules_python = rules_python, |
347 | 343 | )) |
348 | 344 | rctx.file("{}/BUILD.bazel".format(python_version), "") |
349 | 345 |
|
350 | 346 | pip_bzl = """\ |
351 | 347 | # Generated by python/private/toolchains_repo.bzl |
352 | 348 |
|
353 | | -load("@{rules_python}//python:pip.bzl", "pip_parse", _multi_pip_parse = "multi_pip_parse") |
| 349 | +load("@@{rules_python}//python:pip.bzl", "pip_parse", _multi_pip_parse = "multi_pip_parse") |
354 | 350 |
|
355 | 351 | def multi_pip_parse(name, requirements_lock, **kwargs): |
356 | 352 | return _multi_pip_parse( |
|
0 commit comments