releasetools: Make scripts pylint clean.
Clean up the following scripts.
blockimgdiff.py
common.py
edify_generator.py
img_from_target_files.py
ota_from_target_files.py
Seems we don't have a way to force pylint-ing the scripts using
per-directory pylintrc files (and we don't have pylint tool in AOSP
repo), per
https://android.googlesource.com/platform/tools/repohooks/#todo_limitations.
Test: `m dist`
Test: pylint --rcfile=pylintrc <script.py>
Change-Id: Ia6fd1ddc86f4d84c68e500f225d4a89d0fea8ec7
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index e6e8c9f..01ff149 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -28,17 +28,17 @@
from __future__ import print_function
+import os
+import shutil
import sys
+import zipfile
+
+import common
if sys.hexversion < 0x02070000:
print("Python 2.7 or newer is required.", file=sys.stderr)
sys.exit(1)
-import os
-import shutil
-import zipfile
-
-import common
OPTIONS = common.OPTIONS
@@ -51,11 +51,12 @@
def main(argv):
- bootable_only = [False]
+ # This allows modifying the value from inner function.
+ bootable_only_array = [False]
def option_handler(o, _):
if o in ("-z", "--bootable_zip"):
- bootable_only[0] = True
+ bootable_only_array[0] = True
else:
return False
return True
@@ -65,7 +66,7 @@
extra_long_opts=["bootable_zip"],
extra_option_handler=option_handler)
- bootable_only = bootable_only[0]
+ bootable_only = bootable_only_array[0]
if len(args) != 2:
common.Usage(__doc__)