Skip to content

Commit

Permalink
Merge pull request #569 from googlefonts/ninja-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens authored Sep 4, 2023
2 parents 939d936 + 94a4968 commit 45d8770
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 112 deletions.
23 changes: 20 additions & 3 deletions Lib/gftools/builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
import argparse
import logging
import os
import platform
import re
import shutil
import statmake.classes
Expand Down Expand Up @@ -642,17 +643,29 @@ def main(args=None):

args = parser.parse_args(args)

builder_class = GFBuilder

try:
if platform.system() != "Windows":
from gftools.builder._ninja import NinjaBuilder

builder_class = NinjaBuilder
except ImportError as e:
pass

if len(args.file) == 1 and (
args.file[0].endswith(".yaml") or args.file[0].endswith(".yml")
):
builder = GFBuilder(configfile=args.file[0])
builder_args = dict(configfile=args.file[0])
else:
config={"sources": args.file}
if args.stylespace:
config["stylespaceFile"] = args.stylespace
if args.family_name:
config["familyName"] = args.family_name
builder = GFBuilder(config=config)
builder_args = dict(config=config)

builder = builder_class(**builder_args)

if args.no_autohint:
builder.config["autohintTTF"] = False
Expand All @@ -672,7 +685,11 @@ def main(args=None):
fp.write(yaml.dump(config, Dumper=yaml.SafeDumper))
sys.exit()

builder.build()
try:
builder.build()
except NotImplementedError:
builder = GFBuilder(**builder_args)
builder.build()

if __name__ == "__main__":
main()
Loading

0 comments on commit 45d8770

Please sign in to comment.