diff options
author | Gerald Combs <gerald@wireshark.org> | 2020-11-03 11:22:14 -0800 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2020-11-05 06:46:35 +0000 |
commit | 30c392f166475a251ea8c3cfde305b40971bbbef (patch) | |
tree | c2f48ab77206590f470c64797c3405c08a8914bc /tools/checklicenses.py | |
parent | ebfa1f8a4b7165b7cee85a8f32c42b0de7d9f651 (diff) |
Tools+test: Call python3 explicitly.
PEP 394[1] says,
"In cases where the script is expected to be executed outside virtual
environments, developers will need to be aware of the following
discrepancies across platforms and installation methods:
* Older Linux distributions will provide a python command that refers
to Python 2, and will likely not provide a python2 command.
* Some newer Linux distributions will provide a python command that
refers to Python 3.
* Some Linux distributions will not provide a python command at all by
default, but will provide a python3 command by default."
Debian has forced the issue by choosing the third option[2]:
"NOTE: Debian testing (bullseye) has removed the "python" package and
the '/usr/bin/python' symlink due to the deprecation of Python 2."
Switch our shebang from "#!/usr/bin/env python" to "#!/usr/bin/env
python3" in some places. Remove some 2/3 version checks if we know we're
running under Python 3. Remove the "coding: utf-8" in a bunch of places
since that's the default in Python 3.
[1]https://www.python.org/dev/peps/pep-0394/#for-python-script-publishers
[2]https://wiki.debian.org/Python
Diffstat (limited to 'tools/checklicenses.py')
-rwxr-xr-x | tools/checklicenses.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/checklicenses.py b/tools/checklicenses.py index ca98aab731..b339d3aea5 100755 --- a/tools/checklicenses.py +++ b/tools/checklicenses.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause @@ -186,9 +186,8 @@ def check_licenses(options, args): stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = licensecheck.communicate() - if sys.version_info[0] >= 3: - stdout = stdout.decode('utf-8') - stderr = stderr.decode('utf-8') + stdout = stdout.decode('utf-8') + stderr = stderr.decode('utf-8') if options.verbose: print('----------- licensecheck stdout -----------') print(stdout) |