From e4dd555000b824f11783d99b93d4a713fe34dd1d Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Fri, 16 Dec 2022 15:03:39 -0500 Subject: [PATCH] Use python3 shebang for all python scripts The `python` command may not exist on a system with Python 3 installed. See https://peps.python.org/pep-0394/ for a discussion of the commands expected to be installed. Since Python2 was officially sunsetted almost three years ago (https://www.python.org/doc/sunset-python-2/), IWYU should prefer compatibility with newer systems over older ones. Python code in scripts is still Python3/Python2-compatible, but we will no longer make an effort to preserve Python2 support over time. Fixes #1096. --- fix_includes.py | 2 +- fix_includes_test.py | 2 +- iwyu-check-license-header.py | 2 +- iwyu_test_util.py | 2 +- iwyu_tool.py | 2 +- iwyu_tool_test.py | 2 +- mapgen/iwyu-mapgen-cpython.py | 2 +- mapgen/iwyu-mapgen-qt.py | 2 +- run_iwyu_tests.py | 4 ++-- scrub-logs.py | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fix_includes.py b/fix_includes.py index c5ff2fb..db6d933 100755 --- a/fix_includes.py +++ b/fix_includes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- fix_includes.py - rewrite source files based on iwyu output ------===## # diff --git a/fix_includes_test.py b/fix_includes_test.py index f9413f9..009f5ce 100755 --- a/fix_includes_test.py +++ b/fix_includes_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- fix_includes_test.py - test for fix_includes.py ------------------===## # diff --git a/iwyu-check-license-header.py b/iwyu-check-license-header.py index 3651147..13f3a6e 100755 --- a/iwyu-check-license-header.py +++ b/iwyu-check-license-header.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- iwyu-check-license-header.py - check license headers -------------===## # diff --git a/iwyu_test_util.py b/iwyu_test_util.py index f117d66..69bb781 100755 --- a/iwyu_test_util.py +++ b/iwyu_test_util.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- iwyu_test_util.py - include-what-you-use test framework ----------===## # diff --git a/iwyu_tool.py b/iwyu_tool.py index fcb210e..0b40db5 100755 --- a/iwyu_tool.py +++ b/iwyu_tool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- iwyu_tool.py -----------------------------------------------------===## # diff --git a/iwyu_tool_test.py b/iwyu_tool_test.py index 6d0864b..a48149c 100755 --- a/iwyu_tool_test.py +++ b/iwyu_tool_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- iwyu_tool_test.py - test for iwyu_tool.py ------------------------===## # diff --git a/mapgen/iwyu-mapgen-cpython.py b/mapgen/iwyu-mapgen-cpython.py index cdbcb85..ef5ad63 100755 --- a/mapgen/iwyu-mapgen-cpython.py +++ b/mapgen/iwyu-mapgen-cpython.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- iwyu-mapgen-cpython.py -------------------------------------------===## # diff --git a/mapgen/iwyu-mapgen-qt.py b/mapgen/iwyu-mapgen-qt.py index 0fca4ad..0a6022b 100755 --- a/mapgen/iwyu-mapgen-qt.py +++ b/mapgen/iwyu-mapgen-qt.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- iwyu-mapgen-qt.py ------------------------------------------------===## # diff --git a/run_iwyu_tests.py b/run_iwyu_tests.py index 1eeb139..f19fc42 100755 --- a/run_iwyu_tests.py +++ b/run_iwyu_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- run_iwyu_tests.py - include-what-you-use test framework driver ---===## # @@ -52,7 +52,7 @@ def TestIwyuOnRelevantFiles(filename): glob.glob('%s/*/%s-*' % (dirname, basename)) + glob.glob('%s.h' % all_but_extension) + glob.glob('%s/*/%s.h' % (dirname, basename))) - + files_to_check = [f for f in all_files if not f.endswith(extension)] files_to_check.append(filename) diff --git a/scrub-logs.py b/scrub-logs.py index b289ea3..aaa7e00 100755 --- a/scrub-logs.py +++ b/scrub-logs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ##===--- scrub-logs.py - generate README from Wiki sources ----------------===## #