-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Git references in subset merger (#987)
* Support Git references in subset merger In YAML, you can now do: repo: slug: notofonts/latin-greek-cyrillic ref: e7f1736c5ad0dc2abfc4dcd49ebca50abf612b29 Where before repo could only take a string (being the repo slug) This is still supported with the old behaviour of assuming you want the latest of the branch * Simplify reference specifying approach Keep the repo key as a string, interpret anything after @ as the git ref * Type hinting fairy visits * Support '@latest' to get latest GitHub release for a subset * Check if sources are already downloaded after resolving 'latest' * Return resolved ref to fix designspace discovery * Resolve 'latest' to tag early and don't use official zipball URL Add GitHubClient.get_latest_tag_name() This massively simplifies code paths and doesn't require SubsetMerger.download_for_subsetting to have to do more than it should This also allows us to know the name of the top level folder within the zip file in all scenarios download_for_subsetting code is now a fair bit simpler and far more similar to before the ref feature was added
- Loading branch information
Showing
3 changed files
with
68 additions
and
19 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
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 |
---|---|---|
|
@@ -74,7 +74,11 @@ def main(args=None): | |
|
||
parser.add_argument("--yaml", "-y", help="YAML file describing subsets") | ||
|
||
parser.add_argument("--repo", "-r", help="GitHub repository to use for subsetting") | ||
parser.add_argument( | ||
"--repo", | ||
"-r", | ||
help="GitHub repository slug to use for subsetting. Use @ after slug to specify branch/tag/commit, e.g. org/[email protected]; 'latest' is supported for latest release", | ||
) | ||
parser.add_argument("--file", "-f", help="Source file within GitHub repository") | ||
parser.add_argument("--name", "-n", help="Name of subset to use from glyphset") | ||
parser.add_argument( | ||
|
@@ -107,6 +111,7 @@ def main(args=None): | |
print("Must specify --name or --codepoints") | ||
sys.exit(1) | ||
# And then construct the YAML-like object ourselves | ||
# See subsets_schema in ..subsetmerger | ||
subsets = [ | ||
{ | ||
"from": { | ||
|
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