diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-08 10:28:10 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-20 13:40:30 +0000 |
commit | e733310db58160074f574c429d48f8308c0afe17 (patch) | |
tree | f8aef4b7e62a69928dbcf880620eece20f98c6df /chromium/tools/resources/optimize-ico-files.py | |
parent | 2f583e4aec1ae3a86fa047829c96b310dc12ecdf (diff) | |
download | qtwebengine-chromium-e733310db58160074f574c429d48f8308c0afe17.tar.gz |
BASELINE: Update Chromium to 56.0.2924.122
Change-Id: I4e04de8f47e47e501c46ed934c76a431c6337ced
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/tools/resources/optimize-ico-files.py')
-rwxr-xr-x | chromium/tools/resources/optimize-ico-files.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/chromium/tools/resources/optimize-ico-files.py b/chromium/tools/resources/optimize-ico-files.py index 2635e9c509b..5f0f7163990 100755 --- a/chromium/tools/resources/optimize-ico-files.py +++ b/chromium/tools/resources/optimize-ico-files.py @@ -32,6 +32,9 @@ def main(args=None): nargs='+', help='.ico files to be crushed') parser.add_argument('-o', dest='optimization_level', metavar='OPT', type=int, help='optimization level') + parser.add_argument('--lint', dest='lint', action='store_true', + help='test the ICO file without modifying (set status ' + 'to 1 on error)') parser.add_argument('-d', '--debug', dest='debug', action='store_true', help='enable debug logging') @@ -40,11 +43,20 @@ def main(args=None): if args.debug: logging.getLogger().setLevel(logging.DEBUG) + failed = False for file in args.files: buf = StringIO.StringIO() file.seek(0, os.SEEK_END) old_length = file.tell() file.seek(0, os.SEEK_SET) + + if args.lint: + for error in ico_tools.LintIcoFile(file): + logging.warning('%s: %s', file.name, error) + # Any errors should cause this process to exit with a status of 1. + failed = True + continue + ico_tools.OptimizeIcoFile(file, buf, args.optimization_level) new_length = len(buf.getvalue()) @@ -63,5 +75,7 @@ def main(args=None): logging.info('%s : %d => %d (%d bytes : %d %%)', file.name, old_length, new_length, saving, int(saving_percent * 100)) + return failed + if __name__ == '__main__': sys.exit(main()) |