Skip to content

Commit

Permalink
Plug ninja build into builder
Browse files Browse the repository at this point in the history
Module needs renaming to stop "import ninja" importing itself, for some odd reason I don't understand
  • Loading branch information
simoncozens committed Jul 27, 2023
1 parent f6003a5 commit ba4f7b8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Lib/gftools/builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,17 +642,26 @@ def main(args=None):

args = parser.parse_args(args)

from gftools.builder._ninja import NinjaBuilder

try:
builder_class = NinjaBuilder
except ImportError as e:
builder_class = GFBuilder

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 +681,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()
File renamed without changes.

0 comments on commit ba4f7b8

Please sign in to comment.