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

[ttx_diff] Retry normalizer on failure #1040

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
16 changes: 15 additions & 1 deletion resources/scripts/ttx_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from typing import MutableSequence
from glyphsLib import GSFont
from fontTools.designspaceLib import DesignSpaceDocument
import time


_COMPARE_DEFAULTS = "default"
Expand Down Expand Up @@ -121,11 +122,24 @@ def ttx(font_file: Path, can_skip: bool):
return ttx_file


# generate a simple text repr for gpos for this font
# generate a simple text repr for gpos for this font, with retry
def simple_gpos_output(cargo_manifest_path: Path, font_file: Path, out_path: Path, can_skip: bool):
NUM_RETRIES = 5
for i in range(NUM_RETRIES+1):
try:
return simple_gpos_output_impl(cargo_manifest_path, font_file, out_path, can_skip)
except subprocess.CalledProcessError as e:
time.sleep(0.1)
if i >= NUM_RETRIES:
raise e
print(f"normalizer failed with code '{e.returncode}'', retrying", file=sys.stderr)

def simple_gpos_output_impl(cargo_manifest_path: Path, font_file: Path, out_path: Path, can_skip: bool):
if not (can_skip and out_path.is_file()):
temppath = font_file.parent / "markkern.txt"
cmd = [
"timeout",
"10m",
"cargo",
"run",
"--release",
Expand Down
Loading