-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
stop swallowing warnings from Pex by default #20480
Changes from 6 commits
d2d8ce3
3cb4995
cee1f14
9819b0d
b064a69
6633bee
fe1c470
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
from __future__ import annotations | ||
|
||
import dataclasses | ||
import logging | ||
import os.path | ||
from dataclasses import dataclass | ||
from typing import Iterable, List, Mapping, Optional, Tuple | ||
|
@@ -29,6 +30,8 @@ | |
from pants.util.logging import LogLevel | ||
from pants.util.meta import classproperty | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class PexCli(TemplatedExternalTool): | ||
options_scope = "pex-cli" | ||
|
@@ -156,6 +159,8 @@ async def setup_pex_cli_process( | |
|
||
verbosity_args = [f"-{'v' * pex_subsystem.verbosity}"] if pex_subsystem.verbosity > 0 else [] | ||
|
||
warnings_args = [] if pex_subsystem.emit_warnings else ["--no-emit-warnings"] | ||
|
||
# NB: We should always pass `--python-path`, as that tells Pex where to look for interpreters | ||
# when `--python` isn't an absolute path. | ||
resolve_args = [ | ||
|
@@ -171,6 +176,7 @@ async def setup_pex_cli_process( | |
*request.subcommand, | ||
*global_args, | ||
*verbosity_args, | ||
*warnings_args, | ||
*pip_version_args, | ||
*resolve_args, | ||
# NB: This comes at the end because it may use `--` passthrough args, # which must come at | ||
|
@@ -202,6 +208,15 @@ async def setup_pex_cli_process( | |
) | ||
|
||
|
||
def maybe_log_pex_stderr(stderr: bytes, pex_verbosity: int) -> None: | ||
"""Forward Pex's stderr to a Pants logger if conditions are met.""" | ||
log_output = stderr.decode() | ||
if log_output and pex_verbosity > 0: | ||
logger.info("%s", log_output) | ||
elif log_output and "PEXWarning:" in log_output: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about potentially being even more lax here: I would think showing more warnings is better than missing some, e.g. just check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm worried about making a wishy washy guess that someday might cause someone to have to think about unicode case folding in a whacky corner case. I'd rather either have the |
||
logger.warning("%s", log_output) | ||
cognifloyd marked this conversation as resolved.
Show resolved
Hide resolved
cburroughs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
def rules(): | ||
return [ | ||
*collect_rules(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry missed that this test was failing in the pipeline report.
These tighter constarints avoid
which in term allows the "there is no output" assertion in the test to pass.