8000 Fix immutable frozen set bug in defs.bzl by jamiesnape · Pull Request #262 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content

Fix immutable frozen set bug in defs.bzl #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ all_targets: &all_targets
- "//experimental/..."
- "//packaging/..."
- "//python/..."
- "//tests/..."
- "//tools/..."
# As a regression test for #225, check that wheel targets still build when
# their package path is qualified with the repo name.
Expand Down
2 changes: 1 addition & 1 deletion python/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _MIGRATION_TAG = "__PYTHON_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"

def _add_tags(attrs):
if "tags" in attrs and attrs["tags"] != None:
attrs["tags"] += [_MIGRATION_TAG]
attrs["tags"] = attrs["tags"] + [_MIGRATION_TAG]
else:
attrs["tags"] = [_MIGRATION_TAG]
return attrs
Expand Down
24 changes: 24 additions & 0 deletions tests/load_from_macro/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//python:defs.bzl", "py_library")
load(":tags.bzl", "TAGS")

licenses(["notice"])

py_library(
name = "foo",
srcs = ["foo.py"],
tags = TAGS,
)
13 changes: 13 additions & 0 deletions tests/load_from_macro/foo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
18 changes: 18 additions & 0 deletions tests/load_from_macro/tags.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Example tags defined in a separate file.
"""
TAGS = ["first_tag", "second_tag"]
0