-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Update font URLs and add additional error handling #7418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emilykl
wants to merge
6
commits into
master
Choose a base branch
from
fix-font-redirects-ci
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f50a7cd
update font URLs and add additional error handling
emilykl 904bfe1
update baselines
emilykl 16a4a0f
upgrade chrome version in ci
emilykl ff831b2
add fonts to repo
emilykl 6c85949
script should fail if any command fails
emilykl 71a4d77
try overwrite
emilykl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,82 @@ | ||
import os | ||
|
||
import requests | ||
|
||
dirOut = '.circleci/fonts/truetype/googleFonts/' | ||
dir_out = ".circleci/fonts/truetype/googleFonts/" | ||
|
||
|
||
def download(repo, family, types): | ||
for t in types : | ||
name = family + t + '.ttf' | ||
url = repo + name + '?raw=true' | ||
print(url) | ||
req = requests.get(url, allow_redirects=True) | ||
def download(repo, family, types, overwrite=True): | ||
for t in types: | ||
name = family + t + ".ttf" | ||
url = repo + name + "?raw=true" | ||
out_file = dir_out + name | ||
print("Getting: ", url) | ||
if os.path.exists(out_file) and not overwrite: | ||
print(" => Already exists: ", out_file) | ||
continue | ||
req = requests.get(url, allow_redirects=False) | ||
if req.status_code != 200: | ||
# If we get a redirect, print an error so that we know to update the URL | ||
if req.status_code == 302 or req.status_code == 301: | ||
new_url = req.headers.get("Location") | ||
print(f" => Redirected -- please update URL to: {new_url}") | ||
raise RuntimeError(f""" | ||
Download failed. | ||
Status code: {req.status_code} | ||
Message: {req.reason} | ||
""" | ||
) | ||
open(dirOut + name, 'wb').write(req.content) | ||
""") | ||
open(out_file, "wb").write(req.content) | ||
|
||
|
||
download( | ||
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSansMono/', | ||
'NotoSansMono', | ||
[ | ||
'-Regular', | ||
'-Bold' | ||
] | ||
"https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSansMono/hinted/ttf/", | ||
"NotoSansMono", | ||
["-Regular", "-Bold"], | ||
) | ||
|
||
download( | ||
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSans/', | ||
'NotoSans', | ||
[ | ||
'-Regular', | ||
'-Italic', | ||
'-Bold' | ||
] | ||
"https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSans/hinted/ttf/", | ||
"NotoSans", | ||
["-Regular", "-Italic", "-Bold"], | ||
) | ||
|
||
download( | ||
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSerif/', | ||
'NotoSerif', | ||
"https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSerif/hinted/ttf/", | ||
"NotoSerif", | ||
[ | ||
'-Regular', | ||
'-Italic', | ||
'-Bold', | ||
'-BoldItalic', | ||
] | ||
"-Regular", | ||
"-Italic", | ||
"-Bold", | ||
"-BoldItalic", | ||
], | ||
) | ||
|
||
download( | ||
'https://github.com/google/fonts/blob/main/ofl/oldstandardtt/', | ||
'OldStandard', | ||
[ | ||
'-Regular', | ||
'-Italic', | ||
'-Bold' | ||
] | ||
"https://raw.githubusercontent.com/google/fonts/refs/heads/main/ofl/oldstandardtt/", | ||
"OldStandard", | ||
["-Regular", "-Italic", "-Bold"], | ||
) | ||
|
||
download( | ||
'https://github.com/google/fonts/blob/main/ofl/ptsansnarrow/', | ||
'PT_Sans-Narrow-Web', | ||
[ | ||
'-Regular', | ||
'-Bold' | ||
] | ||
"https://raw.githubusercontent.com/google/fonts/refs/heads/main/ofl/ptsansnarrow/", | ||
"PT_Sans-Narrow-Web", | ||
["-Regular", "-Bold"], | ||
) | ||
|
||
download( | ||
'https://github.com/impallari/Raleway/blob/master/fonts/v3.000%20Fontlab/TTF/', | ||
'Raleway', | ||
[ | ||
'-Regular', | ||
'-Regular-Italic', | ||
'-Bold', | ||
'-Bold-Italic' | ||
] | ||
"https://raw.githubusercontent.com/impallari/Raleway/refs/heads/master/fonts/v3.000%20Fontlab/TTF/", | ||
"Raleway", | ||
["-Regular", "-Regular-Italic", "-Bold", "-Bold-Italic"], | ||
) | ||
|
||
download( | ||
'https://github.com/googlefonts/roboto/blob/main/src/hinted/', | ||
'Roboto', | ||
[ | ||
'-Regular', | ||
'-Italic', | ||
'-Bold', | ||
'-BoldItalic' | ||
] | ||
"https://raw.githubusercontent.com/googlefonts/roboto-2/refs/heads/main/src/hinted/", | ||
"Roboto", | ||
["-Regular", "-Italic", "-Bold", "-BoldItalic"], | ||
) | ||
|
||
download( | ||
'https://github.com/expo/google-fonts/blob/main/font-packages/gravitas-one/400Regular/', | ||
'GravitasOne', | ||
[ | ||
'_400Regular' | ||
] | ||
"https://raw.githubusercontent.com/expo/google-fonts/refs/heads/main/font-packages/gravitas-one/400Regular/", | ||
"GravitasOne", | ||
["_400Regular"], | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI was failing with a message about "Chrome failed to start" and this resolved the issue; in any case, it seems good to keep the Chrome version somewhat up to date.