git-repo/subcmds
Mike Frysinger 56ce3468b4 assume environment always accepts strings
Different Python & OS versions have different environ behavior wrt
accepted types & encoding.  Since we're migrating to be Python 3 only,
lets change our code to assume strings always work as that's what the
newer Python 3 does.  This will fail under Python 2 for some env vars,
mostly on Windows, but the effort of maintaining shim layers that can
handle these edge cases isn't worth it when we're dropping that code.

We leave the logic in the `repo` launcher for now as it is simple, and
we want it to be able to switch versions a bit longer than the rest of
the tree.

Here's the support table:
          |    *NIX      |         Windows           |
 Python 2 | ASCII string | str or bytes, not unicode |
 Python 3 | str or bytes | str only                  |

Windows uses strings natively in its environment all the time.  But it
doesn't allow unicode strings under Python 2, so we have to encode.

Python 2 on *NIX is funky in that it always lowers to ASCII, so we had
to manually encode to avoid errors regardless of unicode or str.

Python 3 on Windows & *NIX will accept strings.  *NIX will also accept
bytes but Windows will not.

Bug: https://crbug.com/gerrit/12145
Change-Id: I3cf8f95a06902754ea1f08ad4b28503f7063531b
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/248972
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
2020-02-19 18:03:46 +00:00
..
__init__.py Fix indentation issues reported by flake8 2020-02-12 06:36:22 +00:00
abandon.py resort a few module imports to follow PEP8 2020-02-18 06:28:12 +00:00
branches.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
checkout.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
cherry_pick.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
diff.py diff: delete unused nested func 2020-02-17 23:49:47 +00:00
diffmanifests.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
download.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
forall.py assume environment always accepts strings 2020-02-19 18:03:46 +00:00
gitc_delete.py flake8: Suppress "F821 undefined name" inline for Python 2 names 2020-02-15 04:45:16 +00:00
gitc_init.py pyflakes: Fix remaining "E501 line too long" warnings 2020-02-13 04:54:10 +00:00
grep.py drop old git_require checks 2020-02-12 11:44:59 +00:00
help.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
info.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
init.py avoid negative variables 2020-02-19 00:24:43 +00:00
list.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
manifest.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
overview.py set default file encoding to utf-8 2019-06-13 14:30:52 +00:00
prune.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
rebase.py avoid negative variables 2020-02-19 00:24:43 +00:00
selfupdate.py avoid negative variables 2020-02-19 00:24:43 +00:00
smartsync.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
stage.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
start.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00
status.py resort a few module imports to follow PEP8 2020-02-18 06:28:12 +00:00
sync.py assume environment always accepts strings 2020-02-19 18:03:46 +00:00
upload.py upload: add support for --yes 2020-02-19 16:04:14 +00:00
version.py Fix blank line issues reported by flake8 2020-02-12 06:36:40 +00:00