Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: tools/binary_size/libsupersize/paths.py

Issue 2881563003: supersize: Make Disassemble() work for downloaded .size files (Closed)
Patch Set: self-review Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/binary_size/libsupersize/paths.py
diff --git a/tools/binary_size/libsupersize/paths.py b/tools/binary_size/libsupersize/paths.py
index 53acb7400ba4f120ea06bd4614fb41de2f88db5e..fb8eed645061e8a81f76e35036bd3eae99327ffa 100644
--- a/tools/binary_size/libsupersize/paths.py
+++ b/tools/binary_size/libsupersize/paths.py
@@ -11,6 +11,9 @@ import os
_STATUS_DETECTED = 1
_STATUS_VERIFIED = 2
+SRC_ROOT = os.path.dirname(
+ os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+
class LazyPaths(object):
def __init__(self, tool_prefix=None, output_directory=None,
@@ -87,6 +90,29 @@ class LazyPaths(object):
if os.path.exists(build_vars_path):
with open(build_vars_path) as f:
build_vars = dict(l.rstrip().split('=', 1) for l in f if '=' in l)
- return os.path.normpath(
- os.path.join(output_directory, build_vars['android_tool_prefix']))
+ tool_prefix = build_vars['android_tool_prefix']
+ ret = os.path.normpath(os.path.join(output_directory, tool_prefix))
+ # Need to maintain a trailing /.
+ if tool_prefix.endswith(os.path.sep):
+ ret += os.path.sep
+ return ret
+ from_path = distutils.spawn.find_executable('c++filt')
+ if from_path:
+ return from_path[:-7]
return None
+
+
+def FromSrcRootRelative(path):
+ ret = os.path.relpath(os.path.join(SRC_ROOT, path))
+ # Need to maintain a trailing /.
+ if path.endswith(os.path.sep):
+ ret += os.path.sep
+ return ret
+
+
+def ToSrcRootRelative(path):
+ ret = os.path.relpath(path, SRC_ROOT)
+ # Need to maintain a trailing /.
+ if path.endswith(os.path.sep):
+ ret += os.path.sep
+ return ret

Powered by Google App Engine
This is Rietveld 408576698