From 25ebd55abd8c99dd24e82e027d3fe5d502ce04b7 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Mon, 4 Mar 2024 14:58:17 +0100 Subject: [PATCH] Simplify via getFileSystemBackend() --- .pre-commit-config.yaml | 2 +- src/fontra_compile/__main__.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d16af19..4e3dcf3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: args: ["--profile", "black"] - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.0.0 hooks: - id: flake8 diff --git a/src/fontra_compile/__main__.py b/src/fontra_compile/__main__.py index a9fdb80..f68cabf 100644 --- a/src/fontra_compile/__main__.py +++ b/src/fontra_compile/__main__.py @@ -1,7 +1,8 @@ import argparse import asyncio import pathlib -from importlib.metadata import entry_points + +from fontra.backends import getFileSystemBackend from .builder import Builder @@ -23,11 +24,7 @@ async def main_async(): args.glyph_names.replace(",", " ").split() if args.glyph_names else None ) - fileType = sourceFontPath.suffix.lstrip(".").lower() - backendEntryPoints = entry_points(group="fontra.filesystem.backends") - entryPoint = backendEntryPoints[fileType] - backendClass = entryPoint.load() - reader = backendClass.fromPath(sourceFontPath) + reader = getFileSystemBackend(sourceFontPath) builder = Builder(reader, glyphNames) await builder.setup() ttFont = await builder.build()