Commit 84f28a2a authored by Rob Buckley's avatar Rob Buckley
Browse files

rename function parameters and add comments

parent 008de7fc
...@@ -117,24 +117,28 @@ function pyinst_ext_for_version { ...@@ -117,24 +117,28 @@ function pyinst_ext_for_version {
} }
function pyinst_fname_for_version { function pyinst_fname_for_version {
# echo filename for OSX installer file given Python version # echo filename for OSX installer file given Python and minimum
# macosx versions
# Parameters # Parameters
# $py_version (python version in major.minor.extra format) # $py_version (python version in major.minor.extra format)
# $osx_ver (macosx version in major.minor format, defaults to MACPYTHON_DEFAULT_OSX) # $py_osx_ver (macosx version in major.minor format.
# Note: this is the version the Python is built for,
# and hence the min version supported, not the version
# of the current system
local py_version=$1 local py_version=$1
local osx_ver=${2:-$MACPYTHON_DEFAULT_OSX} local py_osx_ver=${2:-$MACPYTHON_DEFAULT_OSX}
local inst_ext=$(pyinst_ext_for_version $py_version) local inst_ext=$(pyinst_ext_for_version $py_version)
echo "python-$py_version-macosx${osx_ver}.$inst_ext" echo "python-${py_version}-macosx${py_osx_ver}.${inst_ext}"
} }
function mac_arch_for_pyosx_version { function mac_arch_for_pyosx_version {
# echo arch (intel or x86_64) that the given the minimum macOS that # echo arch (intel or x86_64) that cpython builds targetted for the
# the python version is targetted for. # given minimum macOS are targetted for
# Parameters # Parameters
# $py_osx_ver (python version in major.minor.extra format) # $py_osx_ver (python version in major.minor.extra format)
# note this is the version the python is built for, not that of the # note this is the version the python is built for, not that of
# local system # the local system
py_osx_ver=$1 py_osx_ver=$1
check_var $py_osx_ver check_var $py_osx_ver
if [ $py_osx_ver -eq "10.6" ]; then if [ $py_osx_ver -eq "10.6" ]; then
...@@ -153,13 +157,16 @@ function install_macpython { ...@@ -153,13 +157,16 @@ function install_macpython {
# Parameters: # Parameters:
# $version : [implementation-]major[.minor[.patch]] # $version : [implementation-]major[.minor[.patch]]
# The Python implementation to install, e.g. "3.6" or "pypy-5.4" # The Python implementation to install, e.g. "3.6" or "pypy-5.4"
# $osx_version: { 10.6|10.9 }. Ignored for pypy # $py_osx_ver: major.minor
# the macosx version the python is built for, e.g. "10.6" or "10.9"
# Ignored for pypy
local version=$1 local version=$1
local osx_version=$2 local py_osx_ver=$2
if [[ "$version" =~ pypy-([0-9\.]+) ]]; then if [[ "$version" =~ pypy-([0-9\.]+) ]]; then
install_mac_pypy "${BASH_REMATCH[1]}" install_mac_pypy "${BASH_REMATCH[1]}"
elif [[ "$version" =~ ([0-9\.]+) ]]; then elif [[ "$version" =~ ([0-9\.]+) ]]; then
install_mac_cpython "${BASH_REMATCH[1]}" $osx_version check_var $py_osx_ver
install_mac_cpython "${BASH_REMATCH[1]}" $py_osx_ver
else else
echo "config error: Issue parsing this implementation in install_python:" echo "config error: Issue parsing this implementation in install_python:"
echo " version=$version" echo " version=$version"
...@@ -173,12 +180,13 @@ function install_mac_cpython { ...@@ -173,12 +180,13 @@ function install_mac_cpython {
# $py_version # $py_version
# Version given in major or major.minor or major.minor.micro e.g # Version given in major or major.minor or major.minor.micro e.g
# "3" or "3.4" or "3.4.1". # "3" or "3.4" or "3.4.1".
# $osx_version = { 10.6 | 10.9 } # $py_osx_ver
# the macosx version the python is built for e.g. "10.6" or "10.9"
# sets $PYTHON_EXE variable to python executable # sets $PYTHON_EXE variable to python executable
local py_version=$(fill_pyver $1) local py_version=$(fill_pyver $1)
local osx_version=$2 local $py_osx_ver=$2
local py_stripped=$(strip_ver_suffix $py_version) local py_stripped=$(strip_ver_suffix $py_version)
local py_inst=$(pyinst_fname_for_version $py_version $osx_version) local py_inst=$(pyinst_fname_for_version $py_version $py_osx_ver)
local inst_path=$DOWNLOADS_SDIR/$py_inst local inst_path=$DOWNLOADS_SDIR/$py_inst
mkdir -p $DOWNLOADS_SDIR mkdir -p $DOWNLOADS_SDIR
curl $MACPYTHON_URL/$py_stripped/${py_inst} > $inst_path curl $MACPYTHON_URL/$py_stripped/${py_inst} > $inst_path
...@@ -283,10 +291,11 @@ function get_macpython_environment { ...@@ -283,10 +291,11 @@ function get_macpython_environment {
# Parameters: # Parameters:
# $version : [implementation-]major[.minor[.patch]] # $version : [implementation-]major[.minor[.patch]]
# The Python implementation to install, e.g. "3.6" or "pypy-5.4" # The Python implementation to install, e.g. "3.6" or "pypy-5.4"
# $py_osx_ver: [major.minor]
# The macosx version that python is built for, e.g. "10.6" or "10.9"
# $venv_dir : {directory_name|not defined} # $venv_dir : {directory_name|not defined}
# If defined - make virtualenv in this directory, set python / pip # If defined - make virtualenv in this directory, set python / pip
# commands accordingly # commands accordingly
# $osx_version: {10.6 | 10.9}
# #
# Installs Python # Installs Python
# Sets $PYTHON_EXE to path to Python executable # Sets $PYTHON_EXE to path to Python executable
...@@ -294,7 +303,7 @@ function get_macpython_environment { ...@@ -294,7 +303,7 @@ function get_macpython_environment {
# 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
local version=$1 local version=$1
local osx_version=$2 local py_osx_ver=$2
local venv_dir=$3 local venv_dir=$3
if [ "$USE_CCACHE" == "1" ]; then if [ "$USE_CCACHE" == "1" ]; then
...@@ -302,7 +311,7 @@ function get_macpython_environment { ...@@ -302,7 +311,7 @@ function get_macpython_environment {
fi fi
remove_travis_ve_pip remove_travis_ve_pip
install_macpython $version $osx_version install_macpython $version $py_osx_ver
install_pip install_pip
if [ -n "$venv_dir" ]; then if [ -n "$venv_dir" ]; then
......
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