This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix zip bundle structure #27150
Merged
Merged
Fix zip bundle structure #27150
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| import os | ||
| import subprocess | ||
| import sys | ||
| from zipfile import ZipFile | ||
|
|
||
| SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
| SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, '..', '..', '..')) | ||
|
|
@@ -20,8 +21,10 @@ | |
| EXE = '.exe' if IS_WINDOWS else '' | ||
| BAT = '.bat' if IS_WINDOWS else '' | ||
| FONT_SUBSET = os.path.join(SRC_DIR, 'out', 'host_debug', 'font-subset' + EXE) | ||
| FONT_SUBSET_ZIP = os.path.join(SRC_DIR, 'out', 'host_debug', 'zip_archives', 'font-subset.zip') | ||
| if not os.path.isfile(FONT_SUBSET): | ||
| FONT_SUBSET = os.path.join(SRC_DIR, 'out', 'host_debug_unopt', 'font-subset' + EXE) | ||
| FONT_SUBSET_ZIP = os.path.join(SRC_DIR, 'out', 'host_debug_unopt', 'zip_archives', 'font-subset.zip') | ||
| if not os.path.isfile(FONT_SUBSET): | ||
| raise Exception('Could not locate font-subset%s in host_debug or host_debug_unopt - build before running this script.' % EXE) | ||
|
|
||
|
|
@@ -58,7 +61,7 @@ def RunCmd(cmd, codepoints, fail=False): | |
| stderr=subprocess.PIPE, | ||
| cwd=SRC_DIR | ||
| ) | ||
| stdout_data, stderr_data = p.communicate(input=' '.join(codepoints)) | ||
| stdout_data, stderr_data = p.communicate(input=' '.join(codepoints).encode()) | ||
| if p.returncode != 0 and fail == False: | ||
| print('FAILURE: %s' % p.returncode) | ||
| print('STDOUT:') | ||
|
|
@@ -77,9 +80,21 @@ def RunCmd(cmd, codepoints, fail=False): | |
| return p.returncode | ||
|
|
||
|
|
||
| def TestZip(): | ||
| with ZipFile(FONT_SUBSET_ZIP, 'r') as zip: | ||
| files = zip.namelist() | ||
| if 'font-subset%s' % EXE not in files: | ||
| print('expected %s to contain font-subset%s' % (files, EXE)) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will fail if it got inserted into the zip as |
||
| return 1 | ||
| return 0 | ||
|
|
||
|
|
||
| def main(): | ||
| print('Using font subset binary at %s' % FONT_SUBSET) | ||
| print('Using font subset binary at %s (%s)' % (FONT_SUBSET, FONT_SUBSET_ZIP)) | ||
| failures = 0 | ||
|
|
||
| failures += TestZip() | ||
|
|
||
| for should_pass, golden_font, input_font, codepoints in COMPARE_TESTS: | ||
| gen_ttf = os.path.join(SCRIPT_DIR, 'gen', golden_font) | ||
| golden_ttf = os.path.join(SCRIPT_DIR, 'fixtures', golden_font) | ||
|
|
||
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.
.encodeis needed for python3.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.
You can also pass
universal_newlines=Truetosubprocess.Popen.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.
In addition to .encode, or instead of it?
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.
Ahh I see instead of it.