releasetools: Initalize logger when signing.
Other modules have switched to logging module. sign_target_files_apks.py needs to init the logger to get the logs. Test: Run `sign_target_files_apks.py -v`. Check outputs. Test: Run `check_target_files_signatures.py -v`. Change-Id: Ic68c019f6fb14840561885f1194ad6efdfdb7d82
This commit is contained in:
@@ -39,6 +39,7 @@ Usage: check_target_file_signatures [flags] target_files
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -52,6 +53,8 @@ if sys.hexversion < 0x02070000:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Work around a bug in Python's zipfile module that prevents opening of zipfiles
|
# Work around a bug in Python's zipfile module that prevents opening of zipfiles
|
||||||
# if any entry has an extra field of between 1 and 3 bytes (which is common with
|
# if any entry has an extra field of between 1 and 3 bytes (which is common with
|
||||||
# zipaligned APKs). This overrides the ZipInfo._decodeExtra() method (which
|
# zipaligned APKs). This overrides the ZipInfo._decodeExtra() method (which
|
||||||
@@ -415,6 +418,8 @@ def main(argv):
|
|||||||
common.Usage(__doc__)
|
common.Usage(__doc__)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
common.InitLogging()
|
||||||
|
|
||||||
ALL_CERTS.FindLocalCerts()
|
ALL_CERTS.FindLocalCerts()
|
||||||
|
|
||||||
Push("input target_files:")
|
Push("input target_files:")
|
||||||
|
@@ -102,6 +102,7 @@ import base64
|
|||||||
import copy
|
import copy
|
||||||
import errno
|
import errno
|
||||||
import gzip
|
import gzip
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@@ -121,6 +122,8 @@ if sys.hexversion < 0x02070000:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
OPTIONS = common.OPTIONS
|
OPTIONS = common.OPTIONS
|
||||||
|
|
||||||
OPTIONS.extra_apks = {}
|
OPTIONS.extra_apks = {}
|
||||||
@@ -180,11 +183,8 @@ def GetApkFileInfo(filename, compressed_extension, skipped_prefixes):
|
|||||||
|
|
||||||
# skipped_prefixes should be one of set/list/tuple types. Other types such as
|
# skipped_prefixes should be one of set/list/tuple types. Other types such as
|
||||||
# str shouldn't be accepted.
|
# str shouldn't be accepted.
|
||||||
assert (isinstance(skipped_prefixes, tuple) or
|
assert isinstance(skipped_prefixes, (set, list, tuple)), \
|
||||||
isinstance(skipped_prefixes, set) or
|
"Invalid skipped_prefixes input type: {}".format(type(skipped_prefixes))
|
||||||
isinstance(skipped_prefixes, list)), \
|
|
||||||
"Invalid skipped_prefixes input type: {}".format(
|
|
||||||
type(skipped_prefixes))
|
|
||||||
|
|
||||||
compressed_apk_extension = (
|
compressed_apk_extension = (
|
||||||
".apk" + compressed_extension if compressed_extension else None)
|
".apk" + compressed_extension if compressed_extension else None)
|
||||||
@@ -816,7 +816,7 @@ def GetCodenameToApiLevelMap(input_tf_zip):
|
|||||||
result = dict()
|
result = dict()
|
||||||
for codename in codenames:
|
for codename in codenames:
|
||||||
codename = codename.strip()
|
codename = codename.strip()
|
||||||
if len(codename) > 0:
|
if codename:
|
||||||
result[codename] = api_level
|
result[codename] = api_level
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -926,6 +926,8 @@ def main(argv):
|
|||||||
common.Usage(__doc__)
|
common.Usage(__doc__)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
common.InitLogging()
|
||||||
|
|
||||||
input_zip = zipfile.ZipFile(args[0], "r")
|
input_zip = zipfile.ZipFile(args[0], "r")
|
||||||
output_zip = zipfile.ZipFile(args[1], "w",
|
output_zip = zipfile.ZipFile(args[1], "w",
|
||||||
compression=zipfile.ZIP_DEFLATED,
|
compression=zipfile.ZIP_DEFLATED,
|
||||||
|
Reference in New Issue
Block a user