Skip to content

Commit 9f192cc

Browse files
committed
unwind circular dependency
1 parent dfbdc08 commit 9f192cc

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed

python/glob_excludes.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2024 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"Utilities for glob exclusions."
16+
17+
load("//python/private:glob_excludes.bzl", _glob_excludes = "glob_excludes")
18+
19+
glob_excludes = _glob_excludes

python/private/pypi/deps.bzl

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1818
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
19-
load("//python/private:glob_excludes.bzl", "glob_excludes")
2019

2120
_RULE_DEPS = [
2221
# START: maintained by 'bazel run //tools/private/update_deps:update_pip_deps'
@@ -98,52 +97,31 @@ _RULE_DEPS = [
9897
# END: maintained by 'bazel run //tools/private/update_deps:update_pip_deps'
9998
]
10099

101-
_EXCLUSIONS = [
102-
("**/*.py", None),
103-
("**/*.pyc", None),
104-
("**/*.pyc.*", "During pyc creation, temp files named *.pyc.NNN are created"),
105-
("**/*.dist-info/RECORD", None),
106-
("BUILD", None),
107-
("WORKSPACE", None),
108-
] + [(e, None) for e in glob_excludes.version_dependent_exclusions()]
109-
110-
def _to_comment(comment):
111-
if comment:
112-
return " #" + comment
113-
return ""
114-
115-
def _format_exclusions(exclusions, indent_depth):
116-
indent = " " * indent_depth
117-
return "\n".join([
118-
"{indent}\"{excl}\",{comment}".format(
119-
indent = indent,
120-
excl = excl,
121-
comment = _to_comment(comment),
122-
)
123-
for excl, comment in exclusions
124-
])
125-
126100
_GENERIC_WHEEL = """\
127101
package(default_visibility = ["//visibility:public"])
128102
129103
load("@rules_python//python:defs.bzl", "py_library")
104+
load("@rules_python//python:glob_excludes.bzl", "glob_excludes")
130105
131106
py_library(
132107
name = "lib",
133108
srcs = glob(["**/*.py"]),
134-
data = glob(
135-
["**/*"],
109+
data = glob(["**/*"], exclude=[
136110
# These entries include those put into user-installed dependencies by
137111
# data_exclude to avoid non-determinism.
138-
exclude=[
139-
{exclusions}
140-
],
141-
),
112+
"**/*.py",
113+
"**/*.pyc",
114+
"**/*.pyc.*", # During pyc creation, temp files named *.pyc.NNN are created
115+
"**/* *",
116+
"**/*.dist-info/RECORD",
117+
"BUILD",
118+
"WORKSPACE",
119+
] + glob_excludes.version_dependent_exclusions()),
142120
# This makes this directory a top-level in the python import
143121
# search path for anything that depends on this.
144122
imports = ["."],
145123
)
146-
""".format(exclusions = _format_exclusions(_EXCLUSIONS, 12))
124+
"""
147125

148126
# Collate all the repository names so they can be easily consumed
149127
all_repo_names = [name for (name, _, _) in _RULE_DEPS]

0 commit comments

Comments
 (0)