mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
IMPALA-9627: Update utility scripts for Python 3 (part 2)
We're starting to see environments where the system Python ('python') is
Python 3. Updates utility and build scripts to work with Python 3, and
updates check-pylint-py3k.sh to check scripts that use system python.
Fixes other issues found during a full build and test run with Python
3.8 as the default for 'python'.
Fixes a impala-shell tip that was supposed to have been two tips (and
had no space after period when they were printed).
Removes out-of-date deploy.py and various Python 2.6 workarounds.
Testing:
- Full build with /usr/bin/python pointed to python3
- run-all-tests passed with python pointed to python3
- ran push_to_asf.py
Change-Id: Idff388aff33817b0629347f5843ec34c78f0d0cb
Reviewed-on: http://gerrit.cloudera.org:8080/19697
Reviewed-by: Michael Smith <michael.smith@cloudera.com>
Tested-by: Michael Smith <michael.smith@cloudera.com>
This commit is contained in:
@@ -22,7 +22,6 @@ set -euo pipefail
|
||||
DIR="$(dirname "$0")"
|
||||
|
||||
pushd "$DIR"
|
||||
PY26="$(./find_py26.py)"
|
||||
# Directly download packages listed in *requirements.txt, but don't install them.
|
||||
"$PY26" pip_download.py
|
||||
./pip_download.py
|
||||
popd
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# This script finds Python 2.6 or higher on the system and outputs the
|
||||
# system command to stdout. The script exits with a nonzero exit code if
|
||||
# Python 2.6+ is not present.
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
def detect_python_cmd():
|
||||
'''Returns the system command that provides python 2.6 or greater.'''
|
||||
paths = os.getenv("PATH").split(os.path.pathsep)
|
||||
for cmd in ("python", "python27", "python2.7", "python-27", "python-2.7", "python26",
|
||||
"python2.6", "python-26", "python-2.6"):
|
||||
for path in paths:
|
||||
cmd_path = os.path.join(path, cmd)
|
||||
if not os.path.exists(cmd_path) or not os.access(cmd_path, os.X_OK):
|
||||
continue
|
||||
exit = subprocess.call([cmd_path, "-c", textwrap.dedent("""
|
||||
import sys
|
||||
sys.exit(int(sys.version_info[:2] < (2, 6)))""")])
|
||||
if exit == 0:
|
||||
return cmd_path
|
||||
raise Exception("Could not find minimum required python version 2.6")
|
||||
|
||||
|
||||
print(detect_python_cmd())
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
# Implement the basic 'pip download' functionality in a way that gives us more control
|
||||
# over which archive type is downloaded and what post-download steps are executed.
|
||||
# This script requires Python 2.6+.
|
||||
# This script requires Python 2.7+.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import hashlib
|
||||
import multiprocessing.pool
|
||||
import os
|
||||
|
||||
Reference in New Issue
Block a user