]> git.apps.os.sepia.ceph.com Git - teuthology.git/commit
bootstrap,tox.ini: set a UTF-8 locale for decoding non-latin chars 1671/head
authorKefu Chai <kchai@redhat.com>
Sat, 28 Aug 2021 01:10:12 +0000 (09:10 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 28 Aug 2021 01:22:58 +0000 (09:22 +0800)
commitcdb7df85d6afb81fa7cf5e47f868548e5313a24b
tree72b17a39e3aa45579da4083ca96877dadc81e276
parentd0ccb5e7543966c9868cca0e1d0b1e1f5b5df280
bootstrap,tox.ini: set a UTF-8 locale for decoding non-latin chars

Python3 uses locale.getdefaultlocale() to get the locale, which is used
to determine the encoding of filenames.

see https://docs.python.org/3/library/locale.html

there is chance that the specified locale is not capable of decoding the
filenames encoded in non-latin-1 characters, in that case, pip just fails
to decompress that file, like:

me/jenkins-build/build/workspace/teuthology-pull-requests/.tox/flake8/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 508, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "/home/jenkins-build/build/workspace/teuthology-pull-requests/.tox/flake8/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 550, in _prepare_linked_requirement
    local_file = unpack_url(
  File "/home/jenkins-build/build/workspace/teuthology-pull-requests/.tox/flake8/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 249, in unpack_url
    unpack_file(file.path, location, file.content_type)
  File "/home/jenkins-build/build/workspace/teuthology-pull-requests/.tox/flake8/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py", line 256, in unpack_file
    untar_file(filename, location)
  File "/home/jenkins-build/build/workspace/teuthology-pull-requests/.tox/flake8/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py", line 226, in untar_file
    with open(path, "wb") as destfp:
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 137-140: ordinal not in range(256)

in this change, UTF-8 is used, and also change the lang part to
en_US, so the output should be readable to who can read English.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
bootstrap
tox.ini