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

Unified Diff: tools/isolate_driver.py

Issue 970203003: Add support for escaped target names in isolate driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use list-comprehension Created 5 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate_driver.py
diff --git a/tools/isolate_driver.py b/tools/isolate_driver.py
index 6c9f11886633c1343297e885204e50cbb3560fa2..ad521d6a0b3886dd5e0634557fd092270d9d9565 100755
--- a/tools/isolate_driver.py
+++ b/tools/isolate_driver.py
@@ -28,6 +28,7 @@ import StringIO
import subprocess
import sys
import time
+import uuid
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
SWARMING_CLIENT_DIR = os.path.join(TOOLS_DIR, 'swarming_client')
@@ -141,7 +142,16 @@ def raw_build_to_deps(item):
# TODO(maruel): Use a whitelist instead? .stamp, .so.TOC, .dylib.TOC,
# .dll.lib, .exe and empty.
# The first item is the build rule, e.g. 'link', 'cxx', 'phony', etc.
- return filter(using_blacklist, item.split(' ')[1:])
+
+ # In ninja build files, spaces in targets are escaped with a $-prefix.
+ # Create a random UUID to use as a replacement for '$ ' and use it while
+ # splitting the item variable on ' '. When the split has been done, iterate
+ # over all items, and replace the random variable back to the original.
+ rand = str(uuid.uuid4())
Avi (use Gerrit) 2015/03/03 20:20:30 Rather than uuids, can you pick something simple t
nyquist 2015/03/04 02:06:22 Done.
+ items_no_space = item.replace('$ ', rand).split(' ')[1:]
+ items = [it.replace(rand, '$ ') for it in items_no_space]
+
+ return filter(using_blacklist, items)
def collect_deps(target, build_steps, dependencies_added, rules_seen):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698