2017-05-31 17:30:46 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Cause the script to exit if a single command fails.
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Show explicitly which commands are currently running.
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# Much of this is taken from https://github.com/matthew-brett/multibuild.
|
|
|
|
# This script uses "sudo", so you may need to type in a password a couple times.
|
|
|
|
|
|
|
|
MACPYTHON_URL=https://www.python.org/ftp/python
|
|
|
|
MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
|
|
|
|
DOWNLOAD_DIR=python_downloads
|
|
|
|
|
|
|
|
PY_VERSIONS=("2.7.13"
|
|
|
|
"3.5.3"
|
2018-10-18 17:58:39 -07:00
|
|
|
"3.6.1"
|
|
|
|
"3.7.0")
|
2017-05-31 17:30:46 -07:00
|
|
|
PY_INSTS=("python-2.7.13-macosx10.6.pkg"
|
|
|
|
"python-3.5.3-macosx10.6.pkg"
|
2018-10-18 17:58:39 -07:00
|
|
|
"python-3.6.1-macosx10.6.pkg"
|
|
|
|
"python-3.7.0-macosx10.6.pkg")
|
2017-05-31 17:30:46 -07:00
|
|
|
PY_MMS=("2.7"
|
|
|
|
"3.5"
|
2018-10-18 17:58:39 -07:00
|
|
|
"3.6"
|
|
|
|
"3.7")
|
2019-03-15 10:37:57 -07:00
|
|
|
|
|
|
|
# The minimum supported numpy version is 1.14, see
|
|
|
|
# https://issues.apache.org/jira/browse/ARROW-3141
|
|
|
|
NUMPY_VERSIONS=("1.14.5"
|
|
|
|
"1.14.5"
|
|
|
|
"1.14.5"
|
2018-10-18 17:58:39 -07:00
|
|
|
"1.14.5")
|
2017-05-31 17:30:46 -07:00
|
|
|
|
2019-03-15 10:37:57 -07:00
|
|
|
./ci/travis/install-bazel.sh
|
|
|
|
|
2017-05-31 17:30:46 -07:00
|
|
|
mkdir -p $DOWNLOAD_DIR
|
|
|
|
mkdir -p .whl
|
|
|
|
|
|
|
|
for ((i=0; i<${#PY_VERSIONS[@]}; ++i)); do
|
|
|
|
PY_VERSION=${PY_VERSIONS[i]}
|
|
|
|
PY_INST=${PY_INSTS[i]}
|
|
|
|
PY_MM=${PY_MMS[i]}
|
2018-10-18 17:58:39 -07:00
|
|
|
NUMPY_VERSION=${NUMPY_VERSIONS[i]}
|
2017-05-31 17:30:46 -07:00
|
|
|
|
|
|
|
# The -f flag is passed twice to also run git clean in the arrow subdirectory.
|
|
|
|
# The -d flag removes directories. The -x flag ignores the .gitignore file,
|
|
|
|
# and the -e flag ensures that we don't remove the .whl directory.
|
|
|
|
git clean -f -f -x -d -e .whl -e $DOWNLOAD_DIR
|
|
|
|
|
|
|
|
# Install Python.
|
|
|
|
INST_PATH=python_downloads/$PY_INST
|
|
|
|
curl $MACPYTHON_URL/$PY_VERSION/$PY_INST > $INST_PATH
|
|
|
|
sudo installer -pkg $INST_PATH -target /
|
|
|
|
|
2017-08-21 17:49:35 -07:00
|
|
|
PYTHON_EXE=$MACPYTHON_PY_PREFIX/$PY_MM/bin/python$PY_MM
|
2017-05-31 17:30:46 -07:00
|
|
|
PIP_CMD="$(dirname $PYTHON_EXE)/pip$PY_MM"
|
|
|
|
|
2018-03-31 10:33:40 -07:00
|
|
|
pushd /tmp
|
|
|
|
# Install latest version of pip to avoid brownouts
|
|
|
|
curl https://bootstrap.pypa.io/get-pip.py | $PYTHON_EXE
|
|
|
|
popd
|
|
|
|
|
2017-05-31 17:30:46 -07:00
|
|
|
pushd python
|
2018-04-25 22:53:44 -07:00
|
|
|
# Setuptools on CentOS is too old to install arrow 0.9.0, therefore we upgrade.
|
|
|
|
$PIP_CMD install --upgrade setuptools
|
2017-08-21 17:49:35 -07:00
|
|
|
# Install setuptools_scm because otherwise when building the wheel for
|
|
|
|
# Python 3.6, we see an error.
|
2019-01-13 14:28:23 -08:00
|
|
|
$PIP_CMD install -q setuptools_scm==3.1.0
|
2017-05-31 17:30:46 -07:00
|
|
|
# Fix the numpy version because this will be the oldest numpy version we can
|
|
|
|
# support.
|
2018-12-14 20:49:37 -08:00
|
|
|
$PIP_CMD install -q numpy==$NUMPY_VERSION cython==0.29.0
|
2017-05-31 17:30:46 -07:00
|
|
|
# Install wheel to avoid the error "invalid command 'bdist_wheel'".
|
2017-10-19 22:25:56 -07:00
|
|
|
$PIP_CMD install -q wheel
|
2017-08-21 17:49:35 -07:00
|
|
|
# Add the correct Python to the path and build the wheel. This is only
|
|
|
|
# needed so that the installation finds the cython executable.
|
2019-03-07 23:15:11 -08:00
|
|
|
PATH=$MACPYTHON_PY_PREFIX/$PY_MM/bin:$PATH $PYTHON_EXE setup.py bdist_wheel
|
2017-05-31 17:30:46 -07:00
|
|
|
mv dist/*.whl ../.whl/
|
|
|
|
popd
|
|
|
|
done
|
2019-09-21 18:03:10 -07:00
|
|
|
|
|
|
|
git clean -f -f -x -d -e .whl -e $DOWNLOAD_DIR
|