Fix failures with latest gpylint

Change-Id: Id80000b530b0582b907730db9311075a7f5307fa
This commit is contained in:
KongQun Yang 2020-06-02 00:22:36 -07:00
parent 98a9d1baf6
commit 1b262b5784
5 changed files with 25 additions and 9 deletions

View File

@ -30,6 +30,8 @@ Step 1 is only required if there is any gyp file change. Otherwise, you
may just run ninja.
"""
from __future__ import print_function
import os
import sys
@ -108,7 +110,7 @@ if __name__ == '__main__':
else:
os.environ['GYP_GENERATOR_FLAGS'] = gyp_generator_flags
print 'Updating projects from gyp files...'
print('Updating projects from gyp files...')
sys.stdout.flush()
# Off we go...

View File

@ -623,7 +623,13 @@ class PackagerFunctionalTest(PackagerAppTest):
self.assertEqual(self.packager.MpdGenerator(flags), 0)
def testVersion(self):
self.assertRegexpMatches(
# To support python version 2, which does not have assertRegex.
if 'assertRegex' not in dir(self):
assert_regex = self.assertRegexpMatches
else:
assert_regex = self.assertRegex
assert_regex(
self.packager.Version(), '^packager(.exe)? version '
r'((?P<tag>[\w\.]+)-)?(?P<hash>[a-f\d]+)-(debug|release)[\r\n]+.*$')

View File

@ -32,6 +32,8 @@ Steps to install clang-format on your system if you don't have it already:
"""
from __future__ import print_function
import subprocess
import sys
@ -49,8 +51,10 @@ if __name__ == '__main__':
if output not in [
'no modified files to format\n', 'clang-format did not modify any files\n'
]:
print output, '\n'
print 'Code style is not correct. Please run ', ' '.join(command), '\n'
print(output)
print()
print('Code style is not correct. Please run {}.'.format(' '.join(command)))
print()
sys.exit(1)
else:
sys.exit(0)

View File

@ -7,6 +7,8 @@
"""A utility to parse and generate PSSH boxes."""
from __future__ import print_function
import argparse
import base64
import itertools
@ -419,13 +421,13 @@ def main(all_args):
if output_format == 'human' or not output_format:
for box in boxes:
print box.human_string()
print(box.human_string())
else:
box_data = ''.join([x.binary_string() for x in boxes])
if output_format == 'hex':
print base64.b16encode(box_data)
print(base64.b16encode(box_data))
else:
print base64.b64encode(box_data)
print(base64.b64encode(box_data))
if __name__ == '__main__':

View File

@ -7,6 +7,8 @@
# https://developers.google.com/open-source/licenses/bsd
"""This script is used to generate version string for packager."""
from __future__ import print_function
import subprocess
# To support python version before 2.7, which does not have
@ -47,6 +49,6 @@ if __name__ == '__main__':
version_hash = 'unknown-version'
if version_tag:
print '{0}-{1}'.format(version_tag, version_hash)
print('{0}-{1}'.format(version_tag, version_hash))
else:
print version_hash
print(version_hash)