Skip to content

Commit

Permalink
[fix_encoding] Remove fix_encoding
Browse files Browse the repository at this point in the history
The fix_encoding module within depot_tools was included back in the python2[1] days to as a be all encoding fix boilerplate that is called across depot_tools scripts.

However, now that depot_tools officially deprecated support for py2 and support >= 3.8[2], the boilerplate is not needed anymore.

* `fix_win_codec()`[3] The 'cp65001' codec issue this fixes is fixed in python 3.3[4].
* `fix_default_encoding()`[5] python3 defaults to utf8.
* `fix_win_sys_argv()`[6] sys.srgv unicode issue is fixed in python3[7].
* `fix_win_console()`[8] Fixed[9].

TODO: <Get performance changes in windows>.

[1] https://codereview.chromium.org/6721029
[2] https://crrev.com/371aa997c04791d21e222ed43a1a0d55b450dd53/README.md
[3] https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:fix_encoding.py;l=123-132;drc=cfa826c9845122d445dce4f51f556381865dbed3
[4] python/cpython#57425 (comment)
[5] https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:fix_encoding.py;l=29-66;drc=cfa826c9845122d445dce4f51f556381865dbed3
[6] https://crsrc.org/d/fix_encoding.py;l=73-120;drc=cfa826c9845122d445dce4f51f556381865dbed3
[7] python/cpython#46381 (comment)
[8] https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:fix_encoding.py;l=315-344;drc=cfa826c9845122d445dce4f51f556381865dbed3
[9] python/cpython#45943 (comment)

Bug: 1501984
Change-Id: I1d512a4b1bfe14e680ac0aa08027849b999cc638
  • Loading branch information
Aravind Vasudevan committed Feb 2, 2024
1 parent 371aa99 commit a0caffb
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 393 deletions.
322 changes: 0 additions & 322 deletions fix_encoding.py

This file was deleted.

2 changes: 0 additions & 2 deletions gclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
from collections.abc import Collection, Mapping, Sequence

import detect_host_arch
import fix_encoding
import git_common
import gclient_eval
import gclient_paths
Expand Down Expand Up @@ -4122,7 +4121,6 @@ def main(argv):
execute."""
if not can_run_gclient_and_helpers():
return 2
fix_encoding.fix_encoding()
disable_buffering()
setup_color.init()
dispatcher = subcommand.CommandDispatcher(__name__)
Expand Down
2 changes: 0 additions & 2 deletions gerrit_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import sys
import urllib.parse

import fix_encoding
import gerrit_util
import setup_color

Expand Down Expand Up @@ -518,7 +517,6 @@ def main(argv):
if __name__ == '__main__':
# These affect sys.stdout so do it outside of main() to simplify mocks in
# unit testing.
fix_encoding.fix_encoding()
setup_color.init()
try:
sys.exit(main(sys.argv[1:]))
Expand Down
2 changes: 0 additions & 2 deletions git_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from typing import Tuple
import auth
import clang_format
import fix_encoding
import gclient_paths
import gclient_utils
import gerrit_util
Expand Down Expand Up @@ -6707,7 +6706,6 @@ def main(argv):
if __name__ == '__main__':
# These affect sys.stdout, so do it outside of main() to simplify mocks in
# the unit tests.
fix_encoding.fix_encoding()
setup_color.init()
with metrics.collector.print_notice_and_exit():
sys.exit(main(sys.argv[1:]))
2 changes: 0 additions & 2 deletions git_migrate_default_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# found in the LICENSE file.
"""Migrate local repository onto new default branch."""

import fix_encoding
import gerrit_util
import git_common
import metrics
Expand Down Expand Up @@ -91,7 +90,6 @@ def main():


if __name__ == '__main__':
fix_encoding.fix_encoding()
logging.basicConfig(level=logging.INFO)
with metrics.collector.print_notice_and_exit():
try:
Expand Down

0 comments on commit a0caffb

Please sign in to comment.