Commit 01cf6111 authored by Kyle Stewart's avatar Kyle Stewart
Browse files

Use MB_PYTHON_VERSION to pick PyPy implementation.

The syntax is similar to how TravisCI does it.

Travis test uses `get_macpython_enviroment` for CPython and
`get_python_enviroment` for PyPy.
parent 59e72c65
...@@ -31,35 +31,35 @@ matrix: ...@@ -31,35 +31,35 @@ matrix:
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=2.6 - MB_PYTHON_VERSION=pypy-2.6
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=4.0 - MB_PYTHON_VERSION=pypy-4.0
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=5.0 - MB_PYTHON_VERSION=pypy-5.0
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=5.1 - MB_PYTHON_VERSION=pypy-5.1
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=5.3 - MB_PYTHON_VERSION=pypy-5.3
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=5.4 - MB_PYTHON_VERSION=pypy-5.4
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=5.6 - MB_PYTHON_VERSION=pypy-5.6
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- PYPY_VERSION=5.7 - MB_PYTHON_VERSION=pypy-5.7
- VENV=venv - VENV=venv
script: script:
......
...@@ -256,7 +256,7 @@ To use these scripts ...@@ -256,7 +256,7 @@ To use these scripts
- os: osx - os: osx
language: generic language: generic
env: env:
- PYPY_VERSION=5.7 - MB_PYTHON_VERSION=pypy-5.7
before_install: before_install:
- source multibuild/common_utils.sh - source multibuild/common_utils.sh
......
...@@ -121,17 +121,16 @@ function pyinst_ext_for_version { ...@@ -121,17 +121,16 @@ function pyinst_ext_for_version {
} }
function install_python { function install_python {
# Picks an implementation of Python determined by the current enviroment # Picks an implementation of Python determined by the MB_PYTHON_VERSION
# variables, then installs it # enviroment variable, then installs it
# A sub-function will set $PYTHON_EXE variable to the python executable # A sub-function will set $PYTHON_EXE variable to the python executable
if [ -n ${MB_PYTHON_VERSION:-"$PYTHON_VERSION"} ]; then if [[ "$MB_PYTHON_VERSION" =~ pypy-([0-9\.]+) ]]; then
install_macpython ${MB_PYTHON_VERSION:-"$PYTHON_VERSION"} install_mac_pypy "${BASH_REMATCH[1]}"
elif [ -n "$PYPY_VERSION" ]; then elif [[ "$MB_PYTHON_VERSION" =~ ([0-9\.]+) ]]; then
install_mac_pypy $PYPY_VERSION install_macpython "${BASH_REMATCH[1]}"
else else
echo "config error: expected one of these enviroment variables:" echo "config error: Issue parsing MB_PYTHON_VERSION variable:"
echo " MB_PYTHON_VERSION" echo " MB_PYTHON_VERSION=$MB_PYTHON_VERSION"
echo " PYPY_VERSION"
exit 1 exit 1
fi fi
} }
...@@ -274,7 +273,7 @@ function get_macpython_environment { ...@@ -274,7 +273,7 @@ function get_macpython_environment {
# Sets $PIP_CMD to full command for pip (including sudo if necessary) # Sets $PIP_CMD to full command for pip (including sudo if necessary)
# If $venv_dir defined, Sets $VIRTUALENV_CMD to virtualenv executable # If $venv_dir defined, Sets $VIRTUALENV_CMD to virtualenv executable
# Puts directory of $PYTHON_EXE on $PATH # Puts directory of $PYTHON_EXE on $PATH
export MB_PYTHON_VERSION=$1 MB_PYTHON_VERSION=$1
get_python_environment $2 get_python_environment $2
} }
......
...@@ -6,7 +6,11 @@ source tests/test_common_utils.sh ...@@ -6,7 +6,11 @@ source tests/test_common_utils.sh
source tests/test_fill_submodule.sh source tests/test_fill_submodule.sh
if [ -n "$IS_OSX" ]; then if [ -n "$IS_OSX" ]; then
source osx_utils.sh source osx_utils.sh
get_python_environment $VENV if [ -n "$PYTHON_VERSION" ]; then
get_macpython_environment $PYTHON_VERSION $VENV
else
get_python_environment $VENV
fi
source tests/test_python_install.sh source tests/test_python_install.sh
source tests/test_fill_pyver.sh source tests/test_fill_pyver.sh
source tests/test_osx_utils.sh source tests/test_osx_utils.sh
......
...@@ -20,15 +20,16 @@ then ...@@ -20,15 +20,16 @@ then
fi fi
python_mm="${cpython_version:0:1}.${cpython_version:2:1}" python_mm="${cpython_version:0:1}.${cpython_version:2:1}"
requested_version=${PYTHON_VERSION:-${MB_PYTHON_VERSION:-${PYPY_VERSION:-${PYPY3_VERSION}}}} # Remove implementation prefix
# remove any version tags which my have been added to the enviroment variable if [[ "$MB_PYTHON_VERSION" =~ (pypy-)?([0-9\.]+) ]]; then
if [[ "$requested_version" =~ [^-]* ]]; then requested_version=${BASH_REMATCH[2]}
requested_version="$BASH_REMATCH" else
ingest "Error parsing MB_PYTHON_VERSION=$MB_PYTHON_VERSION"
fi fi
# simple regex match, a 2.7 pattern will match 2.7.11, but not 2 # simple regex match, a 2.7 pattern will match 2.7.11, but not 2
if ! [[ "$implementer_version" =~ $requested_version ]]; then if ! [[ "$implementer_version" =~ $requested_version ]]; then
ingest "Wrong python version: $implementer_version" ingest "Wrong python version: ${implementer_version}!=${requested_version}"
fi fi
if [ -n "$VENV" ]; then # in virtualenv if [ -n "$VENV" ]; then # in virtualenv
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment