Auto merge of #27004 - saschanaz:py3-env, r=jdm

Fix Py3 environment setting failures

<!-- Please describe your changes on the following line: -->

`python3 mach build -d` now proceeds to actual build. Since Gecko landed full Python 3 support, updating mozjs should allow us to drop Python 2 to build Servo. (I still see failures on other commands e.g. `test-tidy`.)

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-06-20 14:11:51 -04:00 committed by GitHub
commit 232d9269e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -131,17 +131,17 @@ def archive_deterministically(dir_to_archive, dest_archive, prepend_path=None):
def normalize_env(env):
# There is a bug in subprocess where it doesn't like unicode types in
# There is a bug in Py2 subprocess where it doesn't like unicode types in
# environment variables. Here, ensure all unicode are converted to
# binary. utf-8 is our globally assumed default. If the caller doesn't
# want UTF-8, they shouldn't pass in a unicode instance.
# native string type. utf-8 is our globally assumed default. If the caller
# doesn't want UTF-8, they shouldn't pass in a unicode instance.
normalized_env = {}
for k, v in env.items():
if isinstance(k, six.text_type):
k = k.encode('utf-8', 'strict')
k = six.ensure_str(k, 'utf-8', 'strict')
if isinstance(v, six.text_type):
v = v.encode('utf-8', 'strict')
v = six.ensure_str(v, 'utf-8', 'strict')
normalized_env[k] = v