• Raul Tambre's avatar
    gclient_utils: buffer output as bytestrings in Annotated · 5d284fdf
    Raul Tambre authored
    In Python 3 byestrings and normal strings can't be concatenated.
    To fix this we buffer as bytestrings in the Annotated wrapper.
    We can't decode to a string because the output might come byte-by-byte, so it doesn't work with Unicode characters like .
    
    Also had to update gclient_test.py, where double-wrapping stdout with Annotated caused made output not work and include_zero=True working caused other unintended side-effects.
    
    Example error from "fetch chromium":
    Traceback (most recent call last):
      File "C:\Google\depot_tools\gclient_scm.py", line 1045, in _Clone
        self._Run(clone_cmd, options, cwd=self._root_dir, retry=True,
      File "C:\Google\depot_tools\gclient_scm.py", line 1370, in _Run
        gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs)
      File "C:\Google\depot_tools\gclient_utils.py", line 583, in CheckCallAndFilter
        show_header_if_necessary(needs_header, attempt)
      File "C:\Google\depot_tools\gclient_utils.py", line 533, in show_header_if_necessary
        stdout_write(header.encode())
      File "C:\Google\depot_tools\gclient_utils.py", line 391, in write
        obj[0] += out
    TypeError: can only concatenate str (not "bytes") to str
    
    Bug: 984182
    Change-Id: If7037d30e9faf524f2405258281f6e6cd0bcdcae
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1778745
    Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
    Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
    Auto-Submit: Raul Tambre <raul@tambre.ee>
    5d284fdf
Name
Last commit
Last update
..
gstools Loading commit data...
OWNERS Loading commit data...
auth_test.py Loading commit data...
bot_update_coverage_test.py Loading commit data...
cipd_bootstrap_test.py Loading commit data...
download_from_google_storage_unittest.py Loading commit data...
fix_encoding_test.py Loading commit data...
gclient_eval_unittest.py Loading commit data...
gclient_scm_test.py Loading commit data...
gclient_smoketest.py Loading commit data...
gclient_test.py Loading commit data...
gclient_utils_test.py Loading commit data...
git_cache_test.py Loading commit data...
git_cl_creds_check_report.txt Loading commit data...
git_cl_test.py Loading commit data...
git_common_test.py Loading commit data...
git_dates_test.py Loading commit data...
git_drover_test.py Loading commit data...
git_footers_test.py Loading commit data...
git_hyper_blame_test.py Loading commit data...
git_number_test.py Loading commit data...
git_rebase_update_test.py Loading commit data...
gsutil_test.py Loading commit data...
metrics_test.py Loading commit data...
ninjalog_uploader_test.py Loading commit data...
owners_finder_test.py Loading commit data...
owners_unittest.py Loading commit data...
presubmit_unittest.py Loading commit data...
recipes_test.py Loading commit data...
roll_dep_test.py Loading commit data...
scm_unittest.py Loading commit data...
subprocess2_test.py Loading commit data...
upload_to_google_storage_unittest.py Loading commit data...
watchlists_unittest.py Loading commit data...