Fix python3 compatibility on windows

* Use six.ensure_bytes in pylib/py/generator/ninja.py
* Pass universal_newlines=True to subprocess.Popen calls in
  pylib/gyp/win_tool.py and pylib/gyp/msvs_emulation.py, so that
  captured stdout is read as string instead of as raw bytes
* Replace str.translate calls with re.sub. Python3 doesn't support this
  str.translate with two arguments. re.sub() works the same in python2
  and 3.

Note: six.ensure_binary requires six>=1.15.0 (released 2020-05-21).

Bug: 227327945
Change-Id: I750a290b865bc6d9555f833237b72b9f3efa3b69
Reviewed-on: https://chromium-review.googlesource.com/c/external/gyp/+/3557378
Reviewed-by: Mark Mentovai <mark@chromium.org>
3 files changed
tree: 206e23854e5f80fe933d3c74d7f0c413e2c02080
  1. buildbot/
  2. data/
  3. pylib/
  4. samples/
  5. test/
  6. tools/
  7. .gitignore
  8. AUTHORS
  9. codereview.settings
  10. DEPS
  11. gyp
  12. gyp.bat
  13. gyp_main.py
  14. gyptest.py
  15. LICENSE
  16. OWNERS
  17. PRESUBMIT.py
  18. README.md
  19. setup.py
README.md

GYP can Generate Your Projects.

Documents are available at gyp.gsrc.io, or you can check out md-pages branch to read those documents offline.