mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Detect hung builders
This commit is contained in:
22
publish.py
22
publish.py
@@ -45,18 +45,28 @@ def echo_cmd(cmd: Iterable[str]) -> None:
|
|||||||
end = '\n'
|
end = '\n'
|
||||||
if isatty:
|
if isatty:
|
||||||
end = f'\x1b[m{end}'
|
end = f'\x1b[m{end}'
|
||||||
print('\x1b[32m', end='')
|
print('\x1b[32m', end='') # ]]]]]
|
||||||
print(shlex.join(cmd), end=end, flush=True)
|
print(shlex.join(cmd), end=end, flush=True)
|
||||||
|
|
||||||
|
|
||||||
def call(*cmd: str, cwd: Optional[str] = None, echo: bool = False) -> None:
|
def call(*cmd: str, cwd: Optional[str] = None, echo: bool = False, timeout: float | None = None) -> None:
|
||||||
if len(cmd) == 1:
|
if len(cmd) == 1:
|
||||||
q = shlex.split(cmd[0])
|
q = shlex.split(cmd[0])
|
||||||
else:
|
else:
|
||||||
q = list(cmd)
|
q = list(cmd)
|
||||||
if echo:
|
if echo:
|
||||||
echo_cmd(cmd)
|
echo_cmd(cmd)
|
||||||
ret = subprocess.Popen(q, cwd=cwd).wait()
|
p = subprocess.Popen(q, cwd=cwd)
|
||||||
|
try:
|
||||||
|
ret = p.wait(timeout)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
p.terminate()
|
||||||
|
try:
|
||||||
|
p.wait(1)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
p.kill()
|
||||||
|
p.wait()
|
||||||
|
raise
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
raise SystemExit(ret)
|
raise SystemExit(ret)
|
||||||
|
|
||||||
@@ -71,9 +81,9 @@ def run_build(args: Any) -> None:
|
|||||||
m = runpy.run_path('./setup.py', run_name='__publish__')
|
m = runpy.run_path('./setup.py', run_name='__publish__')
|
||||||
vcs_rev: str = m['get_vcs_rev']()
|
vcs_rev: str = m['get_vcs_rev']()
|
||||||
|
|
||||||
def run_with_retry(cmd: str) -> None:
|
def run_with_retry(cmd: str, timeout: float | None = 20 * 60 ) -> None:
|
||||||
try:
|
try:
|
||||||
call(cmd, echo=True)
|
call(cmd, echo=True, timeout=timeout)
|
||||||
except (SystemExit, Exception):
|
except (SystemExit, Exception):
|
||||||
needs_retry = building_nightly and 'linux' not in cmd
|
needs_retry = building_nightly and 'linux' not in cmd
|
||||||
if not needs_retry:
|
if not needs_retry:
|
||||||
@@ -82,7 +92,7 @@ def run_build(args: Any) -> None:
|
|||||||
if 'macos' in cmd:
|
if 'macos' in cmd:
|
||||||
call('python ../bypy macos shutdown')
|
call('python ../bypy macos shutdown')
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
call(cmd, echo=True)
|
call(cmd, echo=True, timeout=timeout)
|
||||||
|
|
||||||
for x in ('64', 'arm64'):
|
for x in ('64', 'arm64'):
|
||||||
prefix = f'python ../bypy linux --arch {x} '
|
prefix = f'python ../bypy linux --arch {x} '
|
||||||
|
|||||||
Reference in New Issue
Block a user