Commit 8af041e2 authored by Kyle Stewart's avatar Kyle Stewart
Browse files

Remove dependance on MB_PYTHON_VERSION.

Functions renamed to match their intent better.
parent 01cf6111
......@@ -31,35 +31,35 @@ matrix:
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-2.6
- PYTHON_VERSION=pypy-2.6
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-4.0
- PYTHON_VERSION=pypy-4.0
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-5.0
- PYTHON_VERSION=pypy-5.0
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-5.1
- PYTHON_VERSION=pypy-5.1
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-5.3
- PYTHON_VERSION=pypy-5.3
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-5.4
- PYTHON_VERSION=pypy-5.4
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-5.6
- PYTHON_VERSION=pypy-5.6
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-5.7
- PYTHON_VERSION=pypy-5.7
- VENV=venv
script:
......
......@@ -120,22 +120,24 @@ function pyinst_ext_for_version {
fi
}
function install_python {
# Picks an implementation of Python determined by the MB_PYTHON_VERSION
# enviroment variable, then installs it
# A sub-function will set $PYTHON_EXE variable to the python executable
if [[ "$MB_PYTHON_VERSION" =~ pypy-([0-9\.]+) ]]; then
function install_macpython {
# Install Python and set $PYTHON_EXE to the installed executable
# Parameters:
# $version : [implementation-]major[.minor[.patch]]
# The Python implementation to install, e.g. "3.6" or "pypy-5.4"
local version=$1
if [[ "$version" =~ pypy-([0-9\.]+) ]]; then
install_mac_pypy "${BASH_REMATCH[1]}"
elif [[ "$MB_PYTHON_VERSION" =~ ([0-9\.]+) ]]; then
install_macpython "${BASH_REMATCH[1]}"
elif [[ "$version" =~ ([0-9\.]+) ]]; then
install_mac_cpython "${BASH_REMATCH[1]}"
else
echo "config error: Issue parsing MB_PYTHON_VERSION variable:"
echo " MB_PYTHON_VERSION=$MB_PYTHON_VERSION"
echo "config error: Issue parsing this implentation in install_python:"
echo " version=$version"
exit 1
fi
}
function install_macpython {
function install_mac_cpython {
# Installs Python.org Python
# Parameter $version
# Version given in major or major.minor or major.minor.micro e.g
......@@ -236,9 +238,11 @@ function set_py_vars {
export PYTHON_EXE PIP_CMD
}
function get_python_environment {
function get_macpython_environment {
# Set up MacPython environment
# Parameters:
# $version : [implementation-]major[.minor[.patch]]
# The Python implementation to install, e.g. "3.6" or "pypy-5.4"
# $venv_dir : {directory_name|not defined}
# If defined - make virtualenv in this directory, set python / pip
# commands accordingly
......@@ -248,9 +252,10 @@ function get_python_environment {
# Sets $PIP_CMD to full command for pip (including sudo if necessary)
# If $venv_dir defined, Sets $VIRTUALENV_CMD to virtualenv executable
# Puts directory of $PYTHON_EXE on $PATH
local venv_dir=$1
local version=$1
local venv_dir=$2
remove_travis_ve_pip
install_python
install_macpython $version
install_pip
if [ -n "$venv_dir" ]; then
install_virtualenv
......@@ -259,24 +264,6 @@ function get_python_environment {
set_py_vars
}
function get_macpython_environment {
# Set up MacPython environment
# Parameters:
# $version :
# major.minor.micro e.g. "3.4.1"
# $venv_dir : {directory_name|not defined}
# If defined - make virtualenv in this directory, set python / pip
# commands accordingly
#
# Installs Python
# Sets $PYTHON_EXE to path to Python executable
# Sets $PIP_CMD to full command for pip (including sudo if necessary)
# If $venv_dir defined, Sets $VIRTUALENV_CMD to virtualenv executable
# Puts directory of $PYTHON_EXE on $PATH
MB_PYTHON_VERSION=$1
get_python_environment $2
}
function repair_wheelhouse {
local wheelhouse=$1
pip install delocate
......
......@@ -6,11 +6,7 @@ source tests/test_common_utils.sh
source tests/test_fill_submodule.sh
if [ -n "$IS_OSX" ]; then
source osx_utils.sh
if [ -n "$PYTHON_VERSION" ]; then
get_macpython_environment $PYTHON_VERSION $VENV
else
get_python_environment $VENV
fi
get_macpython_environment $PYTHON_VERSION $VENV
source tests/test_python_install.sh
source tests/test_fill_pyver.sh
source tests/test_osx_utils.sh
......
......@@ -21,10 +21,10 @@ fi
python_mm="${cpython_version:0:1}.${cpython_version:2:1}"
# Remove implementation prefix
if [[ "$MB_PYTHON_VERSION" =~ (pypy-)?([0-9\.]+) ]]; then
if [[ "$PYTHON_VERSION" =~ (pypy-)?([0-9\.]+) ]]; then
requested_version=${BASH_REMATCH[2]}
else
ingest "Error parsing MB_PYTHON_VERSION=$MB_PYTHON_VERSION"
ingest "Error parsing PYTHON_VERSION=$PYTHON_VERSION"
fi
# simple regex match, a 2.7 pattern will match 2.7.11, but not 2
......
......@@ -15,7 +15,7 @@ source $MULTIBUILD_DIR/library_builders.sh
function before_install {
export CC=clang
export CXX=clang++
get_python_environment venv
get_macpython_environment $MB_PYTHON_VERSION venv
source venv/bin/activate
pip install --upgrade pip wheel
}
......
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