Skip to content

Commit 48b8a71

Browse files
committed
finish the debugging setup
1 parent c9158aa commit 48b8a71

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

python/pip_install/pip_repository.bzl

Lines changed: 11 additions & 1 deletion
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/bzlmod/pip.bzl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,6 @@ The Python version the dependencies are targetting, in Major.Minor format
555555
If an interpreter isn't explicitly provided (using `python_interpreter` or
556556
`python_interpreter_target`), then the version specified here must have
557557
a corresponding `python.toolchain()` configured.
558-
""",
559-
),
560-
"verbosity": attr.string(
561-
default = "",
562-
values = ["TRACE", "DEBUG", "INFO"],
563-
doc = """
564-
The verbosity with which we should print diagnostic messages when 'quiet = False'.
565558
""",
566559
),
567560
"whl_modifications": attr.label_keyed_string_dict(

python/private/repo_utils.bzl

Lines changed: 4 additions & 4 deletions
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),

0 commit comments

Comments
 (0)