Skip to content

Commit c10d026

Browse files
committed
Remove unused imports
1 parent bd12420 commit c10d026

1 file changed

Lines changed: 11 additions & 25 deletions

File tree

pre_commit_hooks/shellcheck_run_steps.py

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import json
66
import os
77
import subprocess
8-
import sys
98
import tempfile
10-
import time
119
from collections.abc import Mapping
1210
from collections.abc import Sequence
1311
from datetime import datetime
@@ -92,11 +90,11 @@ def check_and_update_melange_image(image: str) -> None:
9290

9391
if result.returncode != 0:
9492
# Image doesn't exist locally, pull it
95-
print(
96-
f"Melange image not found locally, pulling {image}...",
97-
file=sys.stderr,
93+
subprocess.run(
94+
["docker", "pull", image],
95+
check=True,
96+
capture_output=True,
9897
)
99-
subprocess.run(["docker", "pull", image], check=True)
10098
return
10199

102100
# Parse the creation date
@@ -106,28 +104,16 @@ def check_and_update_melange_image(image: str) -> None:
106104
age_days = (now - created_date).days
107105

108106
if age_days > 30:
109-
print(
110-
f"⚠️ Melange image is {age_days} days old (created {created_date.strftime('%Y-%m-%d')})",
111-
file=sys.stderr,
107+
# Pull updated image
108+
subprocess.run(
109+
["docker", "pull", image],
110+
check=True,
111+
capture_output=True,
112112
)
113-
print(f"⚠️ Pulling updated melange image: {image}", file=sys.stderr)
114-
print(
115-
"⚠️ Press Ctrl+C now to abort or wait 15 seconds to continue...",
116-
file=sys.stderr,
117-
)
118-
119-
# Give user 15 seconds to abort
120-
time.sleep(15)
121-
122-
print(f"Pulling {image}...", file=sys.stderr)
123-
subprocess.run(["docker", "pull", image], check=True)
124-
print("✓ Melange image updated successfully", file=sys.stderr)
125113

126-
except KeyboardInterrupt:
127-
print("\n⚠️ Update aborted by user, using existing image", file=sys.stderr)
128114
except Exception as e:
129-
print(f"Warning: Failed to check/update melange image: {e}", file=sys.stderr)
130-
print("Continuing with existing image...", file=sys.stderr)
115+
# Print warning to stdout (like epoch check does with echo)
116+
print(f"Warning: Failed to check/update melange image: {e}")
131117

132118

133119
def main(argv: Sequence[str] | None = None) -> int:

0 commit comments

Comments
 (0)