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

Unified Diff: tools/isolate/trace_inputs.py

Issue 10066035: Stop generating DEPTH in trace_inputs.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | tools/isolate/trace_inputs_smoke_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/trace_inputs.py
diff --git a/tools/isolate/trace_inputs.py b/tools/isolate/trace_inputs.py
index f181946aefe1309105f02e68263e4d036a692a46..43cd6ea71ce6546c3531c8562d23a59fa70640bb 100755
--- a/tools/isolate/trace_inputs.py
+++ b/tools/isolate/trace_inputs.py
@@ -16,6 +16,7 @@ import csv
import logging
import optparse
import os
+import posixpath
import re
import subprocess
import sys
@@ -132,6 +133,14 @@ def fix_python_path(cmd):
return out
+def posix_relpath(path, root):
+ """posix.relpath() that keeps trailing slash."""
+ out = posixpath.relpath(path, root)
+ if path.endswith('/'):
+ out += '/'
+ return out
+
+
class Strace(object):
"""strace implies linux."""
IGNORED = (
@@ -1294,12 +1303,10 @@ def trace_inputs(logfile, cmd, root_dir, cwd_dir, product_dir, force_trace):
if product_dir and f.startswith(product_dir):
return '<(PRODUCT_DIR)/%s' % f[len(product_dir):]
- elif cwd_dir and f.startswith(cwd_dir):
+ else:
# cwd_dir is usually the directory containing the gyp file. It may be
# empty if the whole directory containing the gyp file is needed.
- return f[len(cwd_dir):] or './'
- else:
- return '<(DEPTH)/%s' % f
+ return posix_relpath(f, cwd_dir) or './'
corrected = [fix(f) for f in simplified]
tracked = [f for f in corrected if not f.endswith('/') and ' ' not in f]
« no previous file with comments | « no previous file | tools/isolate/trace_inputs_smoke_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698