Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5b01ac

Browse files
committed
Use Label.repo_name instead of Label.workspace_name
According to the documentation, Label.workspace_name is deprecated: https://bazel.build/rules/lib/builtins/Label#workspace_name
1 parent ef205f5 commit e5b01ac

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

gazelle/manifest/defs.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ AllSourcesInfo = provider(fields = {"all_srcs": "All sources collected from the
161161
_rules_python_workspace = Label("@rules_python//:WORKSPACE")
162162

163163
def _get_all_sources_impl(target, ctx):
164-
is_rules_python = target.label.workspace_name == _rules_python_workspace.workspace_name
164+
is_rules_python = target.label.repo_name == _rules_python_workspace.repo_name
165165
if not is_rules_python:
166166
# Avoid adding third-party dependency files to the checksum of the srcs.
167167
return AllSourcesInfo(all_srcs = depset())

python/private/pypi/multi_pip_parse.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ load("//python/private:text_util.bzl", "render")
1818
load(":pip_repository.bzl", pip_parse = "pip_repository")
1919

2020
def _multi_pip_parse_impl(rctx):
21-
rules_python = rctx.attr._rules_python_workspace.workspace_name
21+
rules_python = rctx.attr._rules_python_workspace.repo_name
2222
load_statements = []
2323
install_deps_calls = []
2424
process_requirements_calls = []
@@ -69,7 +69,7 @@ def _process_requirements(pkg_labels, python_version, repo_prefix):
6969
wheel_name = Label(pkg_label).package
7070
if not wheel_name:
7171
# We are dealing with the cases where we don't have aliases.
72-
workspace_name = Label(pkg_label).workspace_name
72+
workspace_name = Label(pkg_label).repo_name
7373
wheel_name = workspace_name[len(repo_prefix):]
7474
7575
_wheel_names.append(wheel_name)

python/private/pypi/whl_library_alias.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ load("//python/private:full_version.bzl", "full_version")
1818
load(":render_pkg_aliases.bzl", "NO_MATCH_ERROR_MESSAGE_TEMPLATE")
1919

2020
def _whl_library_alias_impl(rctx):
21-
rules_python = rctx.attr._rules_python_workspace.workspace_name
21+
rules_python = rctx.attr._rules_python_workspace.repo_name
2222
if rctx.attr.default_version:
2323
default_repo_prefix = rctx.attr.version_map[rctx.attr.default_version]
2424
else:

python/private/pythons_hub.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def _hub_build_file_content(
7979

8080
return _HUB_BUILD_FILE_TEMPLATE.format(
8181
toolchains = toolchains,
82-
rules_python = workspace_location.workspace_name,
82+
rules_python = workspace_location.repo_name,
8383
)
8484

8585
_interpreters_bzl_template = """

python/private/toolchains_repo.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _toolchains_repo_impl(rctx):
9393
load("@{rules_python}//python/private:py_toolchain_suite.bzl", "py_toolchain_suite")
9494
9595
""".format(
96-
rules_python = rctx.attr._rules_python_workspace.workspace_name,
96+
rules_python = rctx.attr._rules_python_workspace.repo_name,
9797
)
9898

9999
toolchains = python_toolchain_build_file_content(
@@ -301,7 +301,7 @@ this repo causes an eager fetch of the toolchain for the host platform.
301301
)
302302

303303
def _multi_toolchain_aliases_impl(rctx):
304-
rules_python = rctx.attr._rules_python_workspace.workspace_name
304+
rules_python = rctx.attr._rules_python_workspace.repo_name
305305

306306
for python_version, repository_name in rctx.attr.python_versions.items():
307307
file = "{}/defs.bzl".format(python_version)

third_party/rules_pycross/pycross/private/wheel_library.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _py_wheel_library_impl(ctx):
8383

8484
# TODO: Is there a more correct way to get this runfiles-relative import path?
8585
imp = paths.join(
86-
ctx.label.workspace_name or ctx.workspace_name, # Default to the local workspace.
86+
ctx.label.repo_name or ctx.workspace_name, # Default to the local workspace.
8787
ctx.label.package,
8888
ctx.label.name,
8989
"site-packages", # we put lib files in this subdirectory.

0 commit comments

Comments
 (0)