You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2023/05/02 21:32:53 UTC
[impala] 01/03: IMPALA-9627 (followup): Skip Python 2 syntax check for Python 3 files
This is an automated email from the ASF dual-hosted git repository.
michaelsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 3166803bfa787e0fd593d870774ba799a2f60e2f
Author: Michael Smith <mi...@cloudera.com>
AuthorDate: Tue May 2 13:22:22 2023 -0700
IMPALA-9627 (followup): Skip Python 2 syntax check for Python 3 files
Updates check-python-syntax.sh to skip checking Python 2 syntax for
files that explicitly run with Python 3. push_to_asf.py was updated to
use Python 3, and is no longer valid Python 2.
Change-Id: I82adf4116404fbd52ec56690e451fda6c32b37cd
Reviewed-on: http://gerrit.cloudera.org:8080/19831
Reviewed-by: Joe McDonnell <jo...@cloudera.com>
Tested-by: Michael Smith <mi...@cloudera.com>
---
bin/check-python-syntax.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/bin/check-python-syntax.sh b/bin/check-python-syntax.sh
index 36a7ff87e..952360b5a 100755
--- a/bin/check-python-syntax.sh
+++ b/bin/check-python-syntax.sh
@@ -36,7 +36,11 @@ for file in $(git ls-files '**/*.py'); do
# -l = no recursion
# -q = only print errors
# -f = force recompile
- if ! python2 -m compileall -l -q -f ${file} > /dev/null 2>&1; then
+ # Ignore files that are created to run with python3.
+ FIRST_LINE=$(head -n1 ${file})
+ if [[ "${FIRST_LINE}" =~ "python3" ]]; then
+ >&2 echo "SKIPPING: ${file} is already using python3: ${FIRST_LINE}"
+ elif ! python2 -m compileall -l -q -f ${file} > /dev/null 2>&1; then
RETCODE=1
echo "Python 2 compilation failed for ${file}:"
set +e