Commit 78ce24e3 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr Committed by Commit Bot

gclient flatten: properly quote conditionals

Bug: 661382
Change-Id: Id50b2541132002452bc5d86bb013758e8be0f4b0
Reviewed-on: https://chromium-review.googlesource.com/697813Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
parent e0214743
...@@ -1997,7 +1997,7 @@ def _DepsToLines(deps): ...@@ -1997,7 +1997,7 @@ def _DepsToLines(deps):
return [] return []
s = ['deps = {'] s = ['deps = {']
for name, dep in sorted(deps.iteritems()): for name, dep in sorted(deps.iteritems()):
condition_part = ([' "condition": "%s",' % dep.condition] condition_part = ([' "condition": %r,' % dep.condition]
if dep.condition else []) if dep.condition else [])
s.extend([ s.extend([
' # %s' % dep.hierarchy(include_url=False), ' # %s' % dep.hierarchy(include_url=False),
...@@ -2019,7 +2019,7 @@ def _DepsOsToLines(deps_os): ...@@ -2019,7 +2019,7 @@ def _DepsOsToLines(deps_os):
for dep_os, os_deps in sorted(deps_os.iteritems()): for dep_os, os_deps in sorted(deps_os.iteritems()):
s.append(' "%s": {' % dep_os) s.append(' "%s": {' % dep_os)
for name, dep in sorted(os_deps.iteritems()): for name, dep in sorted(os_deps.iteritems()):
condition_part = ([' "condition": "%s",' % dep.condition] condition_part = ([' "condition": %r,' % dep.condition]
if dep.condition else []) if dep.condition else [])
s.extend([ s.extend([
' # %s' % dep.hierarchy(include_url=False), ' # %s' % dep.hierarchy(include_url=False),
...@@ -2049,7 +2049,7 @@ def _HooksToLines(name, hooks): ...@@ -2049,7 +2049,7 @@ def _HooksToLines(name, hooks):
if hook.pattern is not None: if hook.pattern is not None:
s.append(' "pattern": "%s",' % hook.pattern) s.append(' "pattern": "%s",' % hook.pattern)
if hook.condition is not None: if hook.condition is not None:
s.append(' "condition": "%s",' % hook.condition) s.append(' "condition": %r,' % hook.condition)
s.extend( s.extend(
# Hooks run in the parent directory of their dep. # Hooks run in the parent directory of their dep.
[' "cwd": "%s",' % os.path.normpath(os.path.dirname(dep.name))] + [' "cwd": "%s",' % os.path.normpath(os.path.dirname(dep.name))] +
...@@ -2078,7 +2078,7 @@ def _HooksOsToLines(hooks_os): ...@@ -2078,7 +2078,7 @@ def _HooksOsToLines(hooks_os):
if hook.pattern is not None: if hook.pattern is not None:
s.append(' "pattern": "%s",' % hook.pattern) s.append(' "pattern": "%s",' % hook.pattern)
if hook.condition is not None: if hook.condition is not None:
s.append(' "condition": "%s",' % hook.condition) s.append(' "condition": %r,' % hook.condition)
s.extend( s.extend(
# Hooks run in the parent directory of their dep. # Hooks run in the parent directory of their dep.
[' "cwd": "%s",' % os.path.normpath(os.path.dirname(dep.name))] + [' "cwd": "%s",' % os.path.normpath(os.path.dirname(dep.name))] +
......
...@@ -662,13 +662,13 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -662,13 +662,13 @@ class GClientSmokeGIT(GClientSmokeBase):
' "src/repo2": {', ' "src/repo2": {',
' "url": "{git_base}repo_2@%s",' % ( ' "url": "{git_base}repo_2@%s",' % (
self.githash('repo_2', 1)[:7]), self.githash('repo_2', 1)[:7]),
' "condition": "True",', ' "condition": \'True\',',
' },', ' },',
'', '',
' # src -> src/repo4', ' # src -> src/repo4',
' "src/repo4": {', ' "src/repo4": {',
' "url": "/repo_4",', ' "url": "/repo_4",',
' "condition": "False",', ' "condition": \'False\',',
' },', ' },',
'', '',
' # src -> src/repo8', ' # src -> src/repo8',
...@@ -719,7 +719,7 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -719,7 +719,7 @@ class GClientSmokeGIT(GClientSmokeBase):
' # src', ' # src',
' {', ' {',
' "pattern": ".",', ' "pattern": ".",',
' "condition": "True",', ' "condition": \'True\',',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python",',
...@@ -837,13 +837,13 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -837,13 +837,13 @@ class GClientSmokeGIT(GClientSmokeBase):
' "src/repo2": {', ' "src/repo2": {',
' "url": "{git_base}repo_2@%s",' % ( ' "url": "{git_base}repo_2@%s",' % (
self.githash('repo_2', 1)), self.githash('repo_2', 1)),
' "condition": "True",', ' "condition": \'True\',',
' },', ' },',
'', '',
' # src -> src/repo4', ' # src -> src/repo4',
' "src/repo4": {', ' "src/repo4": {',
' "url": "/repo_4@%s",' % (self.githash('repo_4', 2)), ' "url": "/repo_4@%s",' % (self.githash('repo_4', 2)),
' "condition": "False",', ' "condition": \'False\',',
' },', ' },',
'', '',
' # src -> src/repo8', ' # src -> src/repo8',
...@@ -894,7 +894,7 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -894,7 +894,7 @@ class GClientSmokeGIT(GClientSmokeBase):
' # src', ' # src',
' {', ' {',
' "pattern": ".",', ' "pattern": ".",',
' "condition": "True",', ' "condition": \'True\',',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python",',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment