Format python files.
I used yapf to apply to Google style but I had to install with pip and
invoke the library as a script so not suitable for integration yet.
Change-Id: I8c3d9c334bf1766f0fff7217270c148a3d1d7662
diff --git a/build/image/extract_offsets.py b/build/image/extract_offsets.py
index 23e711a..c52d01b 100644
--- a/build/image/extract_offsets.py
+++ b/build/image/extract_offsets.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-
"""Extract embedded offsets from an object file.
We let the compiler calculate the offsets it is going to use and have those
@@ -12,35 +11,35 @@
import subprocess
import sys
+
def Main():
- parser = argparse.ArgumentParser()
- parser.add_argument("--tool_prefix", required=True)
- parser.add_argument("--input", required=True)
- parser.add_argument("--output", required=True)
- args = parser.parse_args()
- raw = subprocess.check_output([
- "{}objdump".format(args.tool_prefix),
- "--disassemble-all",
- "--section",
- ".rodata",
- args.input])
- lines = raw.split('\n')
- with open(args.output, 'w') as header:
- header.write('#pragma once\n\n')
- for n in range(len(lines)):
- # Find a defined offset
- match = re.match('.+DEFINE_OFFSET__([^>]+)', lines[n])
- if not match:
- continue
- name = match.group(1)
- # The next line tells the offset
- if "..." in lines[n + 1]:
- offset = 0
- else:
- offset = re.match('.+\.[\S]+\s+(.+)$', lines[n + 1]).group(1)
- # Write the offset to the header
- header.write("#define {} {}\n".format(name, offset))
- return 0
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--tool_prefix", required=True)
+ parser.add_argument("--input", required=True)
+ parser.add_argument("--output", required=True)
+ args = parser.parse_args()
+ raw = subprocess.check_output([
+ "{}objdump".format(args.tool_prefix), "--disassemble-all", "--section",
+ ".rodata", args.input
+ ])
+ lines = raw.split('\n')
+ with open(args.output, 'w') as header:
+ header.write('#pragma once\n\n')
+ for n in range(len(lines)):
+ # Find a defined offset
+ match = re.match('.+DEFINE_OFFSET__([^>]+)', lines[n])
+ if not match:
+ continue
+ name = match.group(1)
+ # The next line tells the offset
+ if "..." in lines[n + 1]:
+ offset = 0
+ else:
+ offset = re.match('.+\.[\S]+\s+(.+)$', lines[n + 1]).group(1)
+ # Write the offset to the header
+ header.write("#define {} {}\n".format(name, offset))
+ return 0
+
if __name__ == "__main__":
- sys.exit(Main())
+ sys.exit(Main())