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

feat(devenv): SENTRY_DEVENV_VERBOSE and fix last rc #76688

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Changes from all commits
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
22 changes: 17 additions & 5 deletions devenv/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ def run_procs(
reporoot: str,
venv_path: str,
_procs: tuple[tuple[str, tuple[str, ...], dict[str, str]], ...],
verbose: bool = False,
) -> bool:
procs: list[tuple[str, tuple[str, ...], subprocess.Popen[bytes]]] = []

stdout = subprocess.PIPE if not verbose else None
stderr = subprocess.STDOUT if not verbose else None

for name, cmd, extra_env in _procs:
print(f"⏳ {name}")
if constants.DEBUG:
Expand All @@ -37,8 +41,8 @@ def run_procs(
cmd,
subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stdout=stdout,
stderr=stderr,
env=env,
cwd=reporoot,
),
Expand All @@ -50,15 +54,15 @@ def run_procs(
out, _ = p.communicate()
if p.returncode != 0:
all_good = False
out_str = f"Output:\n{out.decode()}" if not verbose else ""
print(
f"""
❌ {name}

failed command (code {p.returncode}):
{shlex.join(final_cmd)}

Output:
{out.decode()}
{out_str}

"""
)
Expand All @@ -72,6 +76,9 @@ def main(context: dict[str, str]) -> int:
repo = context["repo"]
reporoot = context["reporoot"]

# TODO: context["verbose"]
verbose = os.environ.get("SENTRY_DEVENV_VERBOSE") is not None

FRONTEND_ONLY = os.environ.get("SENTRY_DEVENV_FRONTEND_ONLY") is not None

# venv's still needed for frontend because repo-local devenv and pre-commit
Expand Down Expand Up @@ -133,6 +140,7 @@ def main(context: dict[str, str]) -> int:
{},
),
),
verbose,
):
return 1

Expand Down Expand Up @@ -168,6 +176,7 @@ def main(context: dict[str, str]) -> int:
{},
),
),
verbose,
):
return 1

Expand All @@ -191,6 +200,7 @@ def main(context: dict[str, str]) -> int:
{},
),
),
verbose,
):
return 1

Expand All @@ -206,6 +216,7 @@ def main(context: dict[str, str]) -> int:
),
("pre-commit dependencies", ("pre-commit", "install", "--install-hooks", "-f"), {}),
),
verbose,
):
return 1

Expand Down Expand Up @@ -246,6 +257,7 @@ def main(context: dict[str, str]) -> int:
{},
),
),
verbose,
):
return 1

Expand Down Expand Up @@ -278,4 +290,4 @@ def main(context: dict[str, str]) -> int:
)
)

return 1
return 0
Loading