Skip to content

Commit

Permalink
feat(devenv): SENTRY_DEVENV_VERBOSE and fix last rc (#76688)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuarli authored Aug 29, 2024
1 parent 6b99112 commit d96c59a
Showing 1 changed file with 17 additions and 5 deletions.
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

0 comments on commit d96c59a

Please sign in to comment.