Fix CheckCIPDManifest for python 3.

Change-Id: Icf7b8e7ad732a731520550ff9e276f13016effb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4149964
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Brian Ryner <bryner@google.com>
changes/64/4149964/4
Brian Ryner 2 years ago committed by LUCI CQ
parent 3e7206ff0a
commit 790a0c522d

@ -1645,6 +1645,8 @@ def CheckCIPDManifest(input_api, output_api, path=None, content=None):
assert path is None, 'Cannot provide both "path" and "content".'
cmd += ['-ensure-file=-']
kwargs['stdin'] = content
if input_api.sys.version_info.major != 2:
kwargs['stdin'] = kwargs['stdin'].encode('utf-8')
# quick and dirty parser to extract checked packages.
packages = [
l.split()[0] for l in (ll.strip() for ll in content.splitlines())

@ -3125,7 +3125,7 @@ the current line as well!
input_api, presubmit.OutputApi, content='manifest_content')
self.assertEqual(command.cmd,
['cipd', 'ensure-file-verify', '-log-level', 'debug', '-ensure-file=-'])
self.assertEqual(command.stdin, 'manifest_content')
self.assertEqual(command.stdin, b'manifest_content')
self.assertEqual(command.kwargs, {
'stdin': subprocess.PIPE,
'stdout': subprocess.PIPE,
@ -3151,7 +3151,7 @@ the current line as well!
})
self.assertEqual(command.cmd,
['cipd', 'ensure-file-verify', '-ensure-file=-'])
self.assertEqual(command.stdin, content)
self.assertEqual(command.stdin, content.encode())
self.assertEqual(command.kwargs, {
'stdin': subprocess.PIPE,
'stdout': subprocess.PIPE,

Loading…
Cancel
Save