Skip to content

Commit

Permalink
[crater] Code review and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyr committed Oct 28, 2024
1 parent 393b92c commit b73e530
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 4 additions & 2 deletions fontc_crater/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,17 @@ fn targets_for_source(

fn should_build_in_gftools_mode(src_path: &Path, config: &Config) -> bool {
// skip noto, which have an implicitly different recipe provider
//https://github.com/googlefonts/oxidize/blob/main/text/2024-06-26-fixes-and-nonstandard-builds.md#noto
if src_path
.file_stem()
.and_then(|stem| stem.to_str().map(|s| s.to_lowercase().contains("noto")))
.and_then(|stem| stem.to_str().map(|s| s.to_lowercase().starts_with("noto")))
.unwrap_or(false)
{
return false;
}

// if there is a recipe provider other than googlefonts, we skip
// if there is a recipe provider other than googlefonts, we skip, because
// it could be doing anything; see above
config
.recipe_provider
.as_ref()
Expand Down
10 changes: 4 additions & 6 deletions resources/scripts/ttx_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import os
from urllib.parse import urlparse
from cdifflib import CSequenceMatcher as SequenceMatcher
from typing import Sequence, Union
from typing import Optional, Sequence
from glyphsLib import GSFont
from fontTools.designspaceLib import DesignSpaceDocument
import time
Expand Down Expand Up @@ -174,7 +174,7 @@ def __init__(self, cmd: Sequence, msg: str):


# run a font compiler
def build(cmd: Sequence, build_dir: Union[Path, None], **kwargs):
def build(cmd: Sequence, build_dir: Optional[Path], **kwargs):
output = log_and_run(cmd, build_dir, **kwargs)
if output.returncode != 0:
raise BuildFail(cmd, output.stderr or output.stdout)
Expand Down Expand Up @@ -235,7 +235,7 @@ def build_fontmake(source: Path, build_dir: Path):


def run_gftools(
source: Path, config: Path, build_dir: Path, fontc_bin: Union[Path, None] = None
source: Path, config: Path, build_dir: Path, fontc_bin: Optional[Path] = None
):
tool = "fontmake" if fontc_bin is None else "fontc"
filename = tool + ".ttf"
Expand Down Expand Up @@ -267,6 +267,7 @@ def run_gftools(
if out_dir.exists():
shutil.rmtree(out_dir)


def source_is_variable(path: Path) -> bool:
if path.suffix == ".ufo":
return False
Expand All @@ -285,9 +286,6 @@ def copy(old, new):
return new


# def find_and_copy_one_file(from_dir: Path, to_file: Path):


def name_id_to_name(ttx, xpath, attr):
id_to_name = {
el.attrib["nameID"]: el.text.strip()
Expand Down

0 comments on commit b73e530

Please sign in to comment.