Skip to content

Commit

Permalink
Reformat with black
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Jun 5, 2024
1 parent 572c40c commit 3501790
Show file tree
Hide file tree
Showing 95 changed files with 4,866 additions and 3,889 deletions.
4 changes: 3 additions & 1 deletion Lib/gftools/actions/checkgooglefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@


if __name__ == "__main__":
config = yaml.load(open(os.path.join("sources", "config.yaml")), Loader=yaml.FullLoader)
config = yaml.load(
open(os.path.join("sources", "config.yaml")), Loader=yaml.FullLoader
)
if "googleFonts" in config and config["googleFonts"]:
print("This font should be submitted to Google Fonts")
print(f"::set-output name=is_gf::true")
Expand Down
4 changes: 3 additions & 1 deletion Lib/gftools/actions/checkversionbump.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def version_has_ever_changed(file, version):


if __name__ == "__main__":
config = yaml.load(open(os.path.join("sources", "config.yaml")), Loader=yaml.FullLoader)
config = yaml.load(
open(os.path.join("sources", "config.yaml")), Loader=yaml.FullLoader
)
sources = config["sources"]

current_version = None
Expand Down
22 changes: 15 additions & 7 deletions Lib/gftools/actions/getlatestversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
from github import Github
import re


def get_latest_release(family, user=None, repo=None):
if not (user and repo):
repo_url = subprocess.check_output(["git", "remote", "get-url", "origin"]).decode("utf8").strip()
repo_url = (
subprocess.check_output(["git", "remote", "get-url", "origin"])
.decode("utf8")
.strip()
)
url_split = repo_url.split("/")
user, repo = url_split[3], url_split[4]

g = Github(os.environ["GITHUB_TOKEN"])
repo = g.get_repo(user + '/' + repo)
repo = g.get_repo(user + "/" + repo)
for release in repo.get_releases():
if release.draft:
continue
Expand All @@ -27,16 +32,19 @@ def get_latest_release(family, user=None, repo=None):
return version, download_url
return None, None


if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Return the URL of a font's latest release artefact")
parser.add_argument('--user', help='the repository username', default="notofonts")
parser.add_argument('--repo', help='the repository name')
parser.add_argument('family', help='the font family name')

parser = argparse.ArgumentParser(
description="Return the URL of a font's latest release artefact"
)
parser.add_argument("--user", help="the repository username", default="notofonts")
parser.add_argument("--repo", help="the repository name")
parser.add_argument("family", help="the font family name")
args = parser.parse_args()

version, download_url = get_latest_release(args.family, args.user, args.repo)
if version and download_url:
print(f"::set-output name=version::{version}")
print(f"::set-output name=url::{download_url}")

24 changes: 17 additions & 7 deletions Lib/gftools/actions/qa2issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@
from gftools.gfgithub import GitHubClient

if __name__ == "__main__":
url_split = subprocess.check_output(["git", "remote", "get-url", "origin"]).decode("utf8").strip().split("/")
url_split = (
subprocess.check_output(["git", "remote", "get-url", "origin"])
.decode("utf8")
.strip()
.split("/")
)
client = GitHubClient(url_split[3], url_split[4])

parser = argparse.ArgumentParser(description='Create or update github issue')
parser.add_argument('--template', help='the issue name',
default="Fontbakery QA Report for Version {}")
parser.add_argument('version', help='the proposed version')
parser.add_argument('file', help='file containing MarkDown content')
parser = argparse.ArgumentParser(description="Create or update github issue")
parser.add_argument(
"--template",
help="the issue name",
default="Fontbakery QA Report for Version {}",
)
parser.add_argument("version", help="the proposed version")
parser.add_argument("file", help="file containing MarkDown content")
args = parser.parse_args()

label = f"qa-{args.version}"
Expand All @@ -45,4 +53,6 @@
client._post(client.rest_url(f"issues/{number}/labels"), {"labels": [label]})
see_url = response["html_url"]

print(f"::error file=sources/config.yaml,title=Fontbakery check failed::See {see_url}")
print(
f"::error file=sources/config.yaml,title=Fontbakery check failed::See {see_url}"
)
51 changes: 29 additions & 22 deletions Lib/gftools/axes_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Lib/gftools/builder/recipeproviders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def sources(self) -> List[File]:
return [get_file(str(p)) for p in self.config["sources"]]



def get_provider(provider: str):
# First try gftools.builder.recipeproviders.X
try:
Expand Down
66 changes: 33 additions & 33 deletions Lib/gftools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,30 @@
NAMEID_DARK_BACKGROUD_PALETTE = 24

NAMEID_STR = {
NAMEID_COPYRIGHT_NOTICE: "COPYRIGHT_NOTICE",
NAMEID_FONT_FAMILY_NAME: "FONT_FAMILY_NAME",
NAMEID_FONT_SUBFAMILY_NAME: "FONT_SUBFAMILY_NAME",
NAMEID_UNIQUE_FONT_IDENTIFIER: "UNIQUE_FONT_IDENTIFIER",
NAMEID_FULL_FONT_NAME: "FULL_FONT_NAME",
NAMEID_VERSION_STRING: "VERSION_STRING",
NAMEID_POSTSCRIPT_NAME: "POSTSCRIPT_NAME",
NAMEID_TRADEMARK: "TRADEMARK",
NAMEID_MANUFACTURER_NAME: "MANUFACTURER_NAME",
NAMEID_DESIGNER: "DESIGNER",
NAMEID_DESCRIPTION: "DESCRIPTION",
NAMEID_VENDOR_URL: "VENDOR_URL",
NAMEID_DESIGNER_URL: "DESIGNER_URL",
NAMEID_LICENSE_DESCRIPTION: "LICENSE_DESCRIPTION",
NAMEID_LICENSE_INFO_URL: "LICENSE_INFO_URL",
NAMEID_TYPOGRAPHIC_FAMILY_NAME: "TYPOGRAPHIC_FAMILY_NAME",
NAMEID_TYPOGRAPHIC_SUBFAMILY_NAME: "TYPOGRAPHIC_SUBFAMILY_NAME",
NAMEID_COMPATIBLE_FULL_MACONLY: "COMPATIBLE_FULL_MACONLY",
NAMEID_SAMPLE_TEXT: "SAMPLE_TEXT",
NAMEID_POSTSCRIPT_CID_NAME: "POSTSCRIPT_CID_NAME",
NAMEID_WWS_FAMILY_NAME: "WWS_FAMILY_NAME",
NAMEID_WWS_SUBFAMILY_NAME: "WWS_SUBFAMILY_NAME",
NAMEID_LIGHT_BACKGROUND_PALETTE: "LIGHT_BACKGROUND_PALETTE",
NAMEID_DARK_BACKGROUD_PALETTE: "DARK_BACKGROUD_PALETTE"
NAMEID_COPYRIGHT_NOTICE: "COPYRIGHT_NOTICE",
NAMEID_FONT_FAMILY_NAME: "FONT_FAMILY_NAME",
NAMEID_FONT_SUBFAMILY_NAME: "FONT_SUBFAMILY_NAME",
NAMEID_UNIQUE_FONT_IDENTIFIER: "UNIQUE_FONT_IDENTIFIER",
NAMEID_FULL_FONT_NAME: "FULL_FONT_NAME",
NAMEID_VERSION_STRING: "VERSION_STRING",
NAMEID_POSTSCRIPT_NAME: "POSTSCRIPT_NAME",
NAMEID_TRADEMARK: "TRADEMARK",
NAMEID_MANUFACTURER_NAME: "MANUFACTURER_NAME",
NAMEID_DESIGNER: "DESIGNER",
NAMEID_DESCRIPTION: "DESCRIPTION",
NAMEID_VENDOR_URL: "VENDOR_URL",
NAMEID_DESIGNER_URL: "DESIGNER_URL",
NAMEID_LICENSE_DESCRIPTION: "LICENSE_DESCRIPTION",
NAMEID_LICENSE_INFO_URL: "LICENSE_INFO_URL",
NAMEID_TYPOGRAPHIC_FAMILY_NAME: "TYPOGRAPHIC_FAMILY_NAME",
NAMEID_TYPOGRAPHIC_SUBFAMILY_NAME: "TYPOGRAPHIC_SUBFAMILY_NAME",
NAMEID_COMPATIBLE_FULL_MACONLY: "COMPATIBLE_FULL_MACONLY",
NAMEID_SAMPLE_TEXT: "SAMPLE_TEXT",
NAMEID_POSTSCRIPT_CID_NAME: "POSTSCRIPT_CID_NAME",
NAMEID_WWS_FAMILY_NAME: "WWS_FAMILY_NAME",
NAMEID_WWS_SUBFAMILY_NAME: "WWS_SUBFAMILY_NAME",
NAMEID_LIGHT_BACKGROUND_PALETTE: "LIGHT_BACKGROUND_PALETTE",
NAMEID_DARK_BACKGROUD_PALETTE: "DARK_BACKGROUD_PALETTE",
}

# Platform IDs:
Expand All @@ -79,17 +79,17 @@
PLATFORM_ID__CUSTOM = 4

PLATID_STR = {
PLATFORM_ID__UNICODE: "UNICODE",
PLATFORM_ID__MACINTOSH: "MACINTOSH",
PLATFORM_ID__ISO: "ISO",
PLATFORM_ID__WINDOWS: "WINDOWS",
PLATFORM_ID__CUSTOM: "CUSTOM"
PLATFORM_ID__UNICODE: "UNICODE",
PLATFORM_ID__MACINTOSH: "MACINTOSH",
PLATFORM_ID__ISO: "ISO",
PLATFORM_ID__WINDOWS: "WINDOWS",
PLATFORM_ID__CUSTOM: "CUSTOM",
}

OFL_LICENSE_INFO = (
"This Font Software is licensed under the SIL Open Font License, "
"Version 1.1. This license is available with a FAQ at: "
"https://openfontlicense.org"
"This Font Software is licensed under the SIL Open Font License, "
"Version 1.1. This license is available with a FAQ at: "
"https://openfontlicense.org"
)

OFL_LICENSE_URL = "https://openfontlicense.org"
Expand Down Expand Up @@ -184,4 +184,4 @@
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE."""
OTHER DEALINGS IN THE FONT SOFTWARE."""
Loading

0 comments on commit 3501790

Please sign in to comment.