Skip to content

Commit 5c80375

Browse files
committed
Merge branch 'refactor/store-dists-in-reqs' into next/multi-platform-whls
2 parents 386e253 + 0fad448 commit 5c80375

File tree

6 files changed

+27
-33
lines changed

6 files changed

+27
-33
lines changed

python/pip_install/pip_repository.bzl

+11-1
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,17 @@ python_interpreter. An example value: "@python3_x86_64-unknown-linux-gnu//:pytho
584584
),
585585
"quiet": attr.bool(
586586
default = True,
587-
doc = "If True, suppress printing stdout and stderr output to the terminal.",
587+
doc = """\
588+
If True, suppress printing stdout and stderr output to the terminal.
589+
590+
If you would like to get more diagnostic output, please use:
591+
592+
RULES_PYTHON_REPO_DEBUG=1
593+
594+
or
595+
596+
RULES_PYTHON_REPO_DEBUG_VERBOSITY=<INFO|DEBUG|TRACE>
597+
""",
588598
),
589599
"repo_prefix": attr.string(
590600
doc = """

python/private/BUILD.bazel

-8
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,6 @@ bzl_library(
140140
],
141141
)
142142

143-
bzl_library(
144-
name = "parse_requirements_add_dists_bzl",
145-
srcs = ["parse_requirements_add_dists.bzl"],
146-
deps = [
147-
":whl_target_platforms_bzl",
148-
],
149-
)
150-
151143
bzl_library(
152144
name = "parse_whl_name_bzl",
153145
srcs = ["parse_whl_name.bzl"],

python/private/bzlmod/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ bzl_library(
3535
"//python/private:full_version_bzl",
3636
"//python/private:normalize_name_bzl",
3737
"//python/private:parse_requirements_bzl",
38-
"//python/private:parse_requirements_add_dists_bzl",
3938
"//python/private:parse_whl_name_bzl",
4039
"//python/private:version_label_bzl",
4140
":bazel_features_bzl",

python/private/bzlmod/pip.bzl

-7
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,6 @@ The Python version the dependencies are targetting, in Major.Minor format
584584
If an interpreter isn't explicitly provided (using `python_interpreter` or
585585
`python_interpreter_target`), then the version specified here must have
586586
a corresponding `python.toolchain()` configured.
587-
""",
588-
),
589-
"verbosity": attr.string(
590-
default = "",
591-
values = ["TRACE", "DEBUG", "INFO"],
592-
doc = """
593-
The verbosity with which we should print diagnostic messages when 'quiet = False'.
594587
""",
595588
),
596589
"whl_modifications": attr.label_keyed_string_dict(

python/private/repo_utils.bzl

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def _logger(rctx):
5151
Returns:
5252
A struct with attributes logging: trace, debug, info, warn, fail.
5353
"""
54-
debug_value = rctx.os.environ.get(REPO_DEBUG_ENV_VAR)
55-
if debug_value == "1":
54+
if _is_repo_debug_enabled(rctx):
5655
verbosity_level = "DEBUG"
5756
else:
5857
verbosity_level = "WARN"
5958

60-
verbosity_level = rctx.os.environ.get(REPO_VERBOSITY_ENV_VAR) or verbosity_level
59+
env_var_verbosity = rctx.os.environ.get(REPO_VERBOSITY_ENV_VAR)
60+
verbosity_level = env_var_verbosity or verbosity_level
6161

6262
verbosity = {
6363
"DEBUG": 2,
@@ -69,7 +69,7 @@ def _logger(rctx):
6969
if verbosity < enabled_on_verbosity:
7070
return
7171

72-
print("{}: ".format(level.upper()), message_cb()) # buildifier: disable=print
72+
print("\nrules_python: {}: ".format(level.upper()), message_cb()) # buildifier: disable=print
7373

7474
return struct(
7575
trace = lambda message_cb: _log(3, "TRACE", message_cb),

tests/private/whl_target_platforms/select_whl_tests.bzl

+12-12
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _test_select_abi3(env):
135135
_tests.append(_test_select_abi3)
136136

137137
def _test_select_by_supported_py_version(env):
138-
for want_version, match in {
138+
for want_python_version, match in {
139139
"3.11": "pkg-0.0.1-py311-abi3-any.whl",
140140
"3.8": "pkg-0.0.1-py3-abi3-any.whl",
141141
}.items():
@@ -147,14 +147,14 @@ def _test_select_by_supported_py_version(env):
147147
],
148148
want_abis = ["abi3"],
149149
want_platforms = ["ignored"],
150-
want_version = want_version,
150+
want_python_version = want_python_version,
151151
)
152152
_match(env, got, match)
153153

154154
_tests.append(_test_select_by_supported_py_version)
155155

156156
def _test_select_by_supported_cp_version(env):
157-
for want_version, match in {
157+
for want_python_version, match in {
158158
"3.11": "pkg-0.0.1-cp311-abi3-any.whl",
159159
"3.8": "pkg-0.0.1-py3-abi3-any.whl",
160160
}.items():
@@ -167,14 +167,14 @@ def _test_select_by_supported_cp_version(env):
167167
],
168168
want_abis = ["abi3"],
169169
want_platforms = ["ignored"],
170-
want_version = want_version,
170+
want_python_version = want_python_version,
171171
)
172172
_match(env, got, match)
173173

174174
_tests.append(_test_select_by_supported_cp_version)
175175

176176
def _test_supported_cp_version_manylinux(env):
177-
for want_version, match in {
177+
for want_python_version, match in {
178178
"3.11": "pkg-0.0.1-cp311-none-manylinux_x86_64.whl",
179179
"3.8": "pkg-0.0.1-py3-none-manylinux_x86_64.whl",
180180
}.items():
@@ -187,7 +187,7 @@ def _test_supported_cp_version_manylinux(env):
187187
],
188188
want_abis = ["none"],
189189
want_platforms = ["linux_x86_64"],
190-
want_version = want_version,
190+
want_python_version = want_python_version,
191191
)
192192
_match(env, got, match)
193193

@@ -207,7 +207,7 @@ _tests.append(_test_ignore_unsupported)
207207

208208
def _test_match_abi_and_not_py_version(env):
209209
# Check we match the ABI and not the py version
210-
got = _select_whls(whls = WHL_LIST, want_abis = ["cp37m"], want_platforms = ["linux_x86_64"], want_version = "3.7")
210+
got = _select_whls(whls = WHL_LIST, want_abis = ["cp37m"], want_platforms = ["linux_x86_64"], want_python_version = "3.7")
211211
_match(
212212
env,
213213
got,
@@ -221,7 +221,7 @@ _tests.append(_test_match_abi_and_not_py_version)
221221

222222
def _test_select_filename_with_many_tags(env):
223223
# Check we can select a filename with many platform tags
224-
got = _select_whls(whls = WHL_LIST, want_abis = ["cp39"], want_platforms = ["linux_x86_32"], want_version = "3.9")
224+
got = _select_whls(whls = WHL_LIST, want_abis = ["cp39"], want_platforms = ["linux_x86_32"], want_python_version = "3.9")
225225
_match(
226226
env,
227227
got,
@@ -239,7 +239,7 @@ def _test_osx_prefer_arch_specific(env):
239239
whls = WHL_LIST,
240240
want_abis = ["cp311"],
241241
want_platforms = ["osx_x86_64", "osx_x86_32"],
242-
want_version = "3.11",
242+
want_python_version = "3.11",
243243
)
244244
_match(
245245
env,
@@ -250,7 +250,7 @@ def _test_osx_prefer_arch_specific(env):
250250
got = _select_whl(whls = got, want_platform = "osx_x86_64")
251251
_match(env, got, "pkg-0.0.1-cp311-cp311-macosx_10_9_x86_64.whl")
252252

253-
got = _select_whls(whls = WHL_LIST, want_abis = ["cp311"], want_platforms = ["osx_aarch64"], want_version = "3.11")
253+
got = _select_whls(whls = WHL_LIST, want_abis = ["cp311"], want_platforms = ["osx_aarch64"], want_python_version = "3.11")
254254
_match(
255255
env,
256256
got,
@@ -264,7 +264,7 @@ _tests.append(_test_osx_prefer_arch_specific)
264264

265265
def _test_osx_fallback_to_universal2(env):
266266
# Check that we can use the universal2 if the arm wheel is not available
267-
got = _select_whls(whls = [w for w in WHL_LIST if "arm64" not in w], want_abis = ["cp311"], want_platforms = ["osx_aarch64"], want_version = "3.11")
267+
got = _select_whls(whls = [w for w in WHL_LIST if "arm64" not in w], want_abis = ["cp311"], want_platforms = ["osx_aarch64"], want_python_version = "3.11")
268268
_match(
269269
env,
270270
got,
@@ -277,7 +277,7 @@ _tests.append(_test_osx_fallback_to_universal2)
277277

278278
def _test_prefer_manylinux_wheels(env):
279279
# Check we prefer platform specific wheels
280-
got = _select_whls(whls = WHL_LIST, want_abis = ["none", "abi3", "cp39"], want_platforms = ["linux_x86_64"], want_version = "3.9")
280+
got = _select_whls(whls = WHL_LIST, want_abis = ["none", "abi3", "cp39"], want_platforms = ["linux_x86_64"], want_python_version = "3.9")
281281
_match(
282282
env,
283283
got,

0 commit comments

Comments
 (0)