-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
283 additions
and
358 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
Removes elements from .glyphs files that we don't care about. | ||
""" | ||
|
||
from pathlib import Path | ||
import re | ||
|
||
|
||
_EXEMPTIONS = { | ||
("Dated.glyphs", "date"), | ||
} | ||
|
||
|
||
def delete_key(plist_file: Path, plist: str, key: str) -> str: | ||
if (plist_file.name, key) in _EXEMPTIONS: | ||
print("skip", plist_file, key) | ||
return plist | ||
return re.sub(f"(?sm)^{key} = .*?;$", "", plist) | ||
|
||
|
||
def main(): | ||
testdata_dir = Path(__file__).parent.parent / "testdata" | ||
assert testdata_dir.is_dir(), testdata_dir | ||
|
||
plist_files = set() | ||
for subdir in ("glyphs2", "glyphs3"): | ||
for pat in ("*.glyphs", "*.plist"): | ||
plist_files.update((testdata_dir / subdir).rglob(pat)) | ||
|
||
assert len(plist_files) > 0 | ||
|
||
for plist_file in plist_files: | ||
plist = plist_file.read_text() | ||
|
||
plist = delete_key(plist_file, plist, "DisplayStrings") | ||
plist = delete_key(plist_file, plist, "date") | ||
plist = delete_key(plist_file, plist, "lastChange") | ||
|
||
plist_file.write_text(plist) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains 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 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 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 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 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 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 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 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 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 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 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 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
Oops, something went wrong.