Skip to content

Commit

Permalink
ARROW-7895: [Python] Remove more python 2.7 cruft
Browse files Browse the repository at this point in the history
I noticed we had some failing nightly builds using python 2.7 so I searched for more places we could remove 2.7.

Closes #6466 from nealrichardson/rm-2.7-more and squashes the following commits:

8fb31e5 <Neal Richardson> More sys removal
d701918 <Neal Richardson> Modernize exception
3e9c8ab <Neal Richardson> Remove unused import
a297d66 <Neal Richardson> Remove more py27 cruft

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Wes McKinney <wesm+git@apache.org>
  • Loading branch information
nealrichardson authored and wesm committed Feb 21, 2020
1 parent f609298 commit 2688a62
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 88 deletions.
24 changes: 9 additions & 15 deletions dev/release/download_rc_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@
#

import re
import sys

try:
import argparse
import concurrent.futures as cf
import functools
import hashlib
import json
import os
import subprocess
import urllib.request
except ImportError:
if sys.version_info.major < 3:
raise Exception("Please use Python 3 to run this script")
raise

import argparse
import concurrent.futures as cf
import functools
import hashlib
import json
import os
import subprocess
import urllib.request


BINTRAY_API_ROOT = "https://bintray.com/api/v1"
Expand Down
9 changes: 2 additions & 7 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ check_python_imports() {
}

test_linux_wheels() {
local py_arches="2.7mu 3.5m 3.6m 3.7m 3.8"
local py_arches="3.5m 3.6m 3.7m 3.8"
local manylinuxes="1 2010 2014"

for py_arch in ${py_arches}; do
Expand All @@ -623,11 +623,6 @@ test_linux_wheels() {
conda activate ${env}

for ml_spec in ${manylinuxes}; do
if [[ "$py_arch" = "2.7mu" && "$ml_spec" = "2014" ]]; then
# manylinux2014 does not support py2.7, so skip that one
continue
fi

# check the mandatory and optional imports
pip install python-rc/${VERSION}-rc${RC_NUMBER}/pyarrow-${VERSION}-cp${py_arch//[mu.]/}-cp${py_arch//./}-manylinux${ml_spec}_x86_64.whl
check_python_imports py_arch
Expand All @@ -644,7 +639,7 @@ test_linux_wheels() {
}

test_macos_wheels() {
local py_arches="2.7m 3.5m 3.6m 3.7m 3.8"
local py_arches="3.5m 3.6m 3.7m 3.8"

for py_arch in ${py_arches}; do
local env=_verify_wheel-${py_arch}
Expand Down
5 changes: 2 additions & 3 deletions dev/tasks/gandiva-jars/build-cpp-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ source /multibuild/manylinux_utils.sh
# Quit on failure
set -e

PYTHON_VERSION=2.7
CPYTHON_PATH="$(cpython_path ${PYTHON_VERSION} 16)"
PYTHON_VERSION=3.6
CPYTHON_PATH="$(cpython_path ${PYTHON_VERSION})"
PYTHON_INTERPRETER="${CPYTHON_PATH}/bin/python"
PIP="${CPYTHON_PATH}/bin/pip"

Expand Down Expand Up @@ -69,4 +69,3 @@ popd

# copy the library to distribution
cp -L /arrow-dist/lib/libgandiva_jni.so /io/dist

9 changes: 3 additions & 6 deletions dev/tasks/python-wheels/manylinux-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ fi

# Test import and optional dependencies
python -c "
import sys
import pyarrow
import pyarrow.parquet
import pyarrow.plasma
import pyarrow.fs
import pyarrow._hdfs
if sys.version_info.major > 2:
import pyarrow.dataset
import pyarrow.flight
import pyarrow.gandiva
import pyarrow.dataset
import pyarrow.flight
import pyarrow.gandiva
"
19 changes: 5 additions & 14 deletions dev/tasks/python-wheels/osx-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,8 @@ function build_wheel {

pip install $(pip_opts) -r python/requirements-wheel.txt cython

if [ ${MB_PYTHON_VERSION} != "2.7" ]; then
# Gandiva is not supported on Python 2.7
export PYARROW_WITH_GANDIVA=1
export BUILD_ARROW_GANDIVA=ON
else
export PYARROW_WITH_GANDIVA=0
export BUILD_ARROW_GANDIVA=OFF
fi
export PYARROW_WITH_GANDIVA=1
export BUILD_ARROW_GANDIVA=ON

git submodule update --init
export ARROW_TEST_DATA=`pwd`/testing/data
Expand Down Expand Up @@ -217,16 +211,13 @@ function run_unit_tests {
function run_import_tests {
# Test optional dependencies
python -c "
import sys
import pyarrow
import pyarrow.parquet
import pyarrow.plasma
import pyarrow.fs
import pyarrow._hdfs
if sys.version_info.major > 2:
import pyarrow.dataset
import pyarrow.flight
import pyarrow.gandiva
import pyarrow.dataset
import pyarrow.flight
import pyarrow.gandiva
"
}
2 changes: 0 additions & 2 deletions dev/tasks/python-wheels/win-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ popd

set PYARROW_BUILD_TYPE=Release
set PYARROW_PARALLEL=8
@rem Flight, Gandiva and Dataset are not supported on Python 2.7,
@rem but we don't build 2.7 wheels for Windows.
set PYARROW_WITH_DATASET=1
set PYARROW_WITH_FLIGHT=1
set PYARROW_WITH_GANDIVA=1
Expand Down
36 changes: 0 additions & 36 deletions dev/tasks/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ groups:
- test-ubuntu-c-glib
- test-debian-ruby
- test-ubuntu-ruby
- test-conda-python-2.7
- test-conda-python-3.6
- test-conda-python-3.7
- test-conda-python-3.8
Expand All @@ -115,8 +114,6 @@ groups:
- test-ubuntu-18.04-r-sanitizer
- test-debian-10-go-1.12
- test-ubuntu-18.04-docs
- test-conda-python-2.7-pandas-latest
- test-conda-python-2.7-pandas-master
- test-conda-python-3.7-pandas-latest
- test-conda-python-3.7-pandas-master
- test-conda-python-3.8-pandas-latest
Expand All @@ -141,7 +138,6 @@ groups:
- test-ubuntu-c-glib
- test-debian-ruby
- test-ubuntu-ruby
- test-conda-python-2.7
- test-conda-python-3.6
- test-conda-python-3.7
- test-conda-python-3.8
Expand Down Expand Up @@ -175,7 +171,6 @@ groups:
- test-ubuntu-c-glib

python:
- test-conda-python-2.7
- test-conda-python-3.6
- test-conda-python-3.7
- test-conda-python-3.8
Expand All @@ -199,8 +194,6 @@ groups:
- test-ubuntu-ruby

integration:
- test-conda-python-2.7-pandas-latest
- test-conda-python-2.7-pandas-master
- test-conda-python-3.7-pandas-latest
- test-conda-python-3.7-pandas-master
- test-conda-python-3.8-pandas-latest
Expand Down Expand Up @@ -269,7 +262,6 @@ groups:
- test-ubuntu-c-glib
- test-debian-ruby
- test-ubuntu-ruby
- test-conda-python-2.7
- test-conda-python-3.6
- test-conda-python-3.7
- test-debian-10-python-3
Expand All @@ -285,7 +277,6 @@ groups:
- test-ubuntu-18.04-r-sanitizer
- test-debian-10-go-1.12
- test-ubuntu-18.04-docs
- test-conda-python-2.7-pandas-latest
- test-conda-python-3.7-pandas-latest
- test-conda-python-3.7-pandas-master
- test-conda-python-3.8-pandas-latest
Expand Down Expand Up @@ -1756,19 +1747,6 @@ tasks:
- docker-compose build ubuntu-ruby
- docker-compose run ubuntu-ruby

test-conda-python-2.7:
ci: circle
platform: linux
template: docker-tests/circle.linux.yml
params:
commands:
- export PYTHON=2.7
- docker-compose pull --ignore-pull-failures conda-cpp
- docker-compose pull --ignore-pull-failures conda-python
- docker-compose build conda-cpp
- docker-compose build conda-python
- docker-compose run conda-python

test-conda-python-3.6:
ci: circle
platform: linux
Expand Down Expand Up @@ -1965,20 +1943,6 @@ tasks:

############################## Integration tests ############################

test-conda-python-2.7-pandas-latest:
ci: circle
platform: linux
template: docker-tests/circle.linux.yml
params:
commands:
- export PYTHON=2.7 PANDAS=latest
- docker-compose pull --ignore-pull-failures conda-cpp
- docker-compose pull --ignore-pull-failures conda-python
- docker-compose build conda-cpp
- docker-compose build conda-python
- docker-compose build --no-cache conda-python-pandas
- docker-compose run conda-python-pandas

test-conda-python-3.7-pandas-latest:
ci: circle
platform: linux
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ services:
# docker-compose run --rm conda-python
# Parameters:
# ARCH: amd64, arm32v7
# PYTHON: 2.7, 3.6, 3.7, 3.8
# PYTHON: 3.6, 3.7, 3.8
image: ${REPO}:${ARCH}-conda-python-${PYTHON}
build:
context: .
Expand Down
2 changes: 1 addition & 1 deletion python/manylinux1/scripts/build_llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cmake -DCMAKE_INSTALL_PREFIX=$PREFIX \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_OCAMLDOC=OFF \
-DLLVM_USE_INTEL_JITEVENTS=ON \
-DPYTHON_EXECUTABLE="$(cpython_path 2.7 32)/bin/python" \
-DPYTHON_EXECUTABLE="$(cpython_path 3.6)/bin/python" \
-GNinja \
..
ninja install
Expand Down
2 changes: 1 addition & 1 deletion python/manylinux1/scripts/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# (https://github.com/pypa/manylinux/).

PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python
CPYTHON_VERSIONS="2.7.15 3.4.9 3.5.6 3.6.8 3.7.2"
CPYTHON_VERSIONS="3.5.6 3.6.8 3.7.2"

# openssl version to build, with expected sha256 hash of .tar.gz
# archive.
Expand Down
3 changes: 1 addition & 2 deletions python/pyarrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ def _has_pkg_config(pkgname):
try:
return subprocess.call([_get_pkg_config_executable(),
'--exists', pkgname]) == 0
except OSError:
# TODO: replace with FileNotFoundError once we ditch 2.7
except FileNotFoundError:
return False


Expand Down

0 comments on commit 2688a62

Please sign in to comment.