Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,43 @@ matrix:
# Build MacOS wheels.
- os: osx
osx_image: xcode7
env: MAC_WHEELS=1
env: MAC_WHEELS=1 PYTHON=2.7
install:
- ./.travis/install-dependencies.sh
# This command should be kept in sync with ray/python/README-building-wheels.md.
- ./python/build-wheel-macos.sh
- ./python/build-wheel-macos.sh -p $PYTHON
script:
- ./.travis/test-wheels.sh
- ./.travis/test-wheels.sh -p $PYTHON

- os: osx
osx_image: xcode7
env: MAC_WHEELS=1 PYTHON=3.4
install:
- ./.travis/install-dependencies.sh
# This command should be kept in sync with ray/python/README-building-wheels.md.
- ./python/build-wheel-macos.sh -p $PYTHON
script:
- ./.travis/test-wheels.sh -p $PYTHON

- os: osx
osx_image: xcode7
env: MAC_WHEELS=1 PYTHON=3.5
install:
- ./.travis/install-dependencies.sh
# This command should be kept in sync with ray/python/README-building-wheels.md.
- ./python/build-wheel-macos.sh -p $PYTHON
script:
- ./.travis/test-wheels.sh -p $PYTHON

- os: osx
osx_image: xcode7
env: MAC_WHEELS=1 PYTHON=3.6
install:
- ./.travis/install-dependencies.sh
# This command should be kept in sync with ray/python/README-building-wheels.md.
- ./python/build-wheel-macos.sh -p $PYTHON
script:
- ./.travis/test-wheels.sh -p $PYTHON

install:
- ./.travis/install-dependencies.sh
Expand Down
21 changes: 21 additions & 0 deletions .travis/test-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ if [[ "$platform" == "linux" ]]; then
fi

elif [[ "$platform" == "macosx" ]]; then

MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
PY_MMS=("2.7"
"3.4"
Expand All @@ -73,11 +74,31 @@ elif [[ "$platform" == "macosx" ]]; then
"34"
"35"
"36")
# There are a few ways around this duplicate code (e.g., environment variable,
# bash function), but each with their own downsides
PY_ARG=''
while getopts 'p:' flag; do
case "${flag}" in
p) PY_ARG="${OPTARG}" ;;
*) error "Unexpected option ${flag}" ;;
esac
done

# Check if the requested Python version is supported
if [[ ! -z "$PY_ARG" ]] && [[ ! " ${PY_MMS[@]} " =~ " ${PY_ARG} " ]]; then
echo "Unexpected Python version $PY_ARG"
exit 1
fi

for ((i=0; i<${#PY_MMS[@]}; ++i)); do
PY_MM=${PY_MMS[i]}
PY_WHEEL_VERSION=${PY_WHEEL_VERSIONS[i]}

if [[ ! -z "$PY_ARG" ]] && [[ "$PY_ARG" != "$PY_MM" ]]; then
echo "Skipping Python version $PY_MM"
continue
fi

PYTHON_EXE=$MACPYTHON_PY_PREFIX/$PY_MM/bin/python$PY_MM
PIP_CMD="$(dirname $PYTHON_EXE)/pip$PY_MM"

Expand Down
21 changes: 21 additions & 0 deletions python/build-wheel-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ PY_MMS=("2.7"
"3.5"
"3.6")

# If Python version is given as an argument, run just that version. This could be
# more advanced (e.g., accept multiple arguments).
PY_ARG=''
while getopts 'p:' flag; do
case "${flag}" in
p) PY_ARG="${OPTARG}" ;;
*) error "Unexpected option ${flag}" ;;
esac
done

# Check if the requested Python version is supported
if [[ ! -z "$PY_ARG" ]] && [[ ! " ${PY_MMS[@]} " =~ " ${PY_ARG} " ]]; then
echo "Unexpected Python version $PY_ARG"
exit 1
fi

mkdir -p $DOWNLOAD_DIR
mkdir -p .whl

Expand All @@ -34,6 +50,11 @@ for ((i=0; i<${#PY_VERSIONS[@]}; ++i)); do
PY_INST=${PY_INSTS[i]}
PY_MM=${PY_MMS[i]}

if [[ ! -z "$PY_ARG" ]] && [[ "$PY_ARG" != "$PY_MM" ]]; then
echo "Skipping Python version $PY_MM"
continue
fi

# 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.
Expand Down