Skip to content

Commit 4aa0a22

Browse files
committed
Suppress animation in CI contexts
Fixes #702
1 parent d214cbf commit 4aa0a22

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Release 0.11.0 (unreleased)
2+
====================================
3+
4+
* Don't show animation when running in CI (#702)
5+
16
Release 0.10.0 (released 2025-03-12)
27
====================================
38

dfetch/project/vcs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ def __init__(self, project: dfetch.manifest.project.ProjectEntry) -> None:
3535
self.__project = project
3636
self.__metadata = Metadata.from_project_entry(self.__project)
3737

38+
self._show_animations = not self._running_in_ci()
39+
40+
@staticmethod
41+
def _running_in_ci() -> bool:
42+
"""Are we running in CI."""
43+
ci_env_var = os.getenv('CI', None)
44+
return ci_env_var and (ci_env_var.lower().startswith("t") or ci_env_var == "1")
45+
3846
def check_wanted_with_local(self) -> Tuple[Optional[Version], Optional[Version]]:
3947
"""Given the project entry in the manifest, get the relevant version from disk.
4048
@@ -109,6 +117,7 @@ def update(self, force: bool = False) -> None:
109117
text=f"Fetching {self.__project.name} {to_fetch}",
110118
spinner="dots",
111119
text_color="green",
120+
enabled=self._show_animations
112121
):
113122
actually_fetched = self._fetch_impl(to_fetch)
114123
self._log_project(f"Fetched {actually_fetched}")
@@ -148,6 +157,7 @@ def check_for_update(self, reporters: Sequence[AbstractCheckReporter]) -> None:
148157
text=f"Checking {self.__project.name}",
149158
spinner="dots",
150159
text_color="green",
160+
enabled=self._show_animations
151161
):
152162
latest_version = self._check_for_newer_version()
153163

0 commit comments

Comments
 (0)