Types
This commit is contained in:
parent
4afdca9461
commit
124193d549
2 changed files with 6 additions and 6 deletions
|
@ -21,5 +21,5 @@ optional arguments:
|
|||
|
||||
## Acknowledgements
|
||||
|
||||
This project makes use of gonts protocol buffer definitions from the
|
||||
This project makes use of font protocol buffer definitions from the
|
||||
[gftools](https://github.com/googlefonts/gftools) repository.
|
||||
|
|
|
@ -4,7 +4,7 @@ import re
|
|||
|
||||
from pathlib import Path
|
||||
from pipes import quote
|
||||
from typing import Iterable
|
||||
from typing import Iterable, Tuple, Optional, Set
|
||||
from unidecode import unidecode
|
||||
|
||||
from nix_google_fonts_gen.repository import Family, Font, families
|
||||
|
@ -84,7 +84,7 @@ LICENSE_MAP = {
|
|||
|
||||
|
||||
def create_overlay(repository: Path, overlay: Path):
|
||||
packages = set()
|
||||
packages: Set[str] = set()
|
||||
for family in families(repository):
|
||||
package = package_derivation(repository, family)
|
||||
if package is not None:
|
||||
|
@ -103,7 +103,7 @@ def create_overlay(repository: Path, overlay: Path):
|
|||
logging.info("Created %d derivations", len(packages))
|
||||
|
||||
|
||||
def package_derivation(repository: Path, family: Family) -> str:
|
||||
def package_derivation(repository: Path, family: Family) -> Optional[Tuple[str, str]]:
|
||||
"""Return nix expression for font family"""
|
||||
name = package_name(family)
|
||||
sources = "\n".join(font_fetcher(repository, font) for font in family.fonts)
|
||||
|
@ -160,8 +160,8 @@ def font_installer(font: Font) -> str:
|
|||
elif ext == ".otf":
|
||||
type = "/opentype"
|
||||
else:
|
||||
logging.warning("unknown font type: %s", filename)
|
||||
type = "/"
|
||||
logging.warning("Unknown font type: %s", filename)
|
||||
type = ""
|
||||
return INSTALL_TEMPLATE.format(file=quote(filename), type=type)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue