Merge "Convert generate-self-extracting-archive.py to python 3"

This commit is contained in:
Treehugger Robot
2022-01-05 18:58:58 +00:00
committed by Gerrit Code Review
2 changed files with 4 additions and 36 deletions

View File

@@ -28,27 +28,11 @@ package {
python_binary_host { python_binary_host {
name: "generate-self-extracting-archive", name: "generate-self-extracting-archive",
srcs: ["generate-self-extracting-archive.py"], srcs: ["generate-self-extracting-archive.py"],
version: {
py2: {
enabled: true,
},
py3: {
enabled: false,
},
},
} }
python_binary_host { python_binary_host {
name: "post_process_props", name: "post_process_props",
srcs: ["post_process_props.py"], srcs: ["post_process_props.py"],
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
},
},
} }
python_test_host { python_test_host {
@@ -58,14 +42,6 @@ python_test_host {
"post_process_props.py", "post_process_props.py",
"test_post_process_props.py", "test_post_process_props.py",
], ],
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
},
},
test_config: "post_process_props_unittest.xml", test_config: "post_process_props_unittest.xml",
test_suites: ["general-tests"], test_suites: ["general-tests"],
} }
@@ -73,14 +49,6 @@ python_test_host {
python_binary_host { python_binary_host {
name: "extract_kernel", name: "extract_kernel",
srcs: ["extract_kernel.py"], srcs: ["extract_kernel.py"],
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
},
},
} }
genrule_defaults { genrule_defaults {

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# #
# Copyright (C) 2019 The Android Open Source Project # Copyright (C) 2019 The Android Open Source Project
# #
@@ -120,7 +120,7 @@ def _generate_extract_command(start, size, extract_name):
def main(argv): def main(argv):
if len(argv) != 5: if len(argv) != 5:
print 'generate-self-extracting-archive.py expects exactly 4 arguments' print('generate-self-extracting-archive.py expects exactly 4 arguments')
sys.exit(1) sys.exit(1)
output_filename = argv[1] output_filename = argv[1]
@@ -134,11 +134,11 @@ def main(argv):
license = license_file.read() license = license_file.read()
if not license: if not license:
print 'License file was empty' print('License file was empty')
sys.exit(1) sys.exit(1)
if 'SOFTWARE LICENSE AGREEMENT' not in license: if 'SOFTWARE LICENSE AGREEMENT' not in license:
print 'License does not look like a license' print('License does not look like a license')
sys.exit(1) sys.exit(1)
comment_line = '# %s\n' % comment comment_line = '# %s\n' % comment