Skip to content
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

Silence stdout/stderr during Pants setup. #375

Merged
merged 5 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: CI
on:
push:
# Ignore non top-level branches.
branches-ignore:
- dependabot/**
- '*/**'
pull_request:
defaults:
run:
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## 0.10.8

Redirect pants install messages to a `pants-install.log` file in pants venv directory to not pollute
stdout/stderr.

## 0.10.7

This release upgrades `pex` to `v2.1.163` and the bootstrap Python to `3.9.18`.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
[package]
name = "scie-pants"
description = "Protects your Pants from the elements."
version = "0.10.7"
version = "0.10.8"
edition = "2021"
authors = [
"John Sirois <john.sirois@gmail.com>",
Expand Down
47 changes: 30 additions & 17 deletions tools/src/scie_pants/install_pants.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,36 @@ def install_pants_from_pex(
" or file an issue on GitHub: https://github.com/pantsbuild/pants/issues/new/choose.\n\n"
f"Exception:\n\n{e}"
)
subprocess.run(
args=[
sys.executable,
pants_pex.name,
"venv",
"--prompt",
prompt,
"--compile",
"--pip",
"--collisions-ok",
"--no-emit-warnings", # Silence `PEXWarning: You asked for --pip ...`
"--disable-cache",
str(venv_dir),
],
env={"PEX_TOOLS": "1"},
check=True,
)
try:
pants_venv_result = subprocess.run(
args=[
sys.executable,
pants_pex.name,
"venv",
"--prompt",
prompt,
"--compile",
"--pip",
"--collisions-ok",
"--no-emit-warnings", # Silence `PEXWarning: You asked for --pip ...`
"--disable-cache",
str(venv_dir),
],
env={"PEX_TOOLS": "1"},
check=True,
capture_output=True,
)
with open(str(venv_dir / "pants-install.log"), "a") as fp:
kaos marked this conversation as resolved.
Show resolved Hide resolved
if pants_venv_result.stdout:
print(pants_venv_result.stdout, file=fp)
if pants_venv_result.stderr:
print(pants_venv_result.stderr, file=fp)
except subprocess.CalledProcessError as e:
fatal(
f"Failed to create Pants virtual environment.\n{e}\n\n"
f"STDOUT:\n{e.stdout}\n\n"
f"STDERR:\n{e.stderr}\n\n"
)

if extra_requirements:
venv_pip_install(
Expand Down
Loading