Commit db8656e7 authored by Matthew Brett's avatar Matthew Brett
Browse files

Refactor unicode width logic

parent 53041500
Subproject commit 8e4f99b151b7456627ec6efe7202c4e1618c74d4 Subproject commit 2781b203f3889e04bee30c5df866b03a902235b7
...@@ -5,6 +5,7 @@ set -e ...@@ -5,6 +5,7 @@ set -e
ROOT_DIR=$(dirname "${BASH_SOURCE[0]}") ROOT_DIR=$(dirname "${BASH_SOURCE[0]}")
UTIL_DIR=${UTIL_DIR:-${ROOT_DIR}/manylinux} UTIL_DIR=${UTIL_DIR:-${ROOT_DIR}/manylinux}
BUILD_SCRIPT=${BUILD_SCRIPT:-/io/$UTIL_DIR/build_package.sh} BUILD_SCRIPT=${BUILD_SCRIPT:-/io/$UTIL_DIR/build_package.sh}
UNICODE_WIDTHS=${UNICODE_WIDTHS:-32}
function before_install { function before_install {
virtualenv --python=python venv virtualenv --python=python venv
...@@ -29,6 +30,25 @@ function build_wheels { ...@@ -29,6 +30,25 @@ function build_wheels {
build_plat_wheels x86_64 build_plat_wheels x86_64
} }
function valid_unicode_widths {
local py_ver=${1:-$TRAVIS_PYTHON_VERSION}
local ok_widths=""
if [ "${py_ver:0:1}" == 2 ]; then local py2=1; fi
for width in ${@:2}; do
if [ "$width" == 32 ]; then
ok_widths="$ok_widths 32"
elif [ "$width" == 16 ]; then
if [ -n "$py2" ]; then
ok_widths="$ok_widths 16"
fi
else
echo "Invalid unicode width $width"
exit 1
fi
done
echo $ok_widths
}
function build_plat_wheels { function build_plat_wheels {
# Builds wheels # Builds wheels
# #
...@@ -44,10 +64,11 @@ function build_plat_wheels { ...@@ -44,10 +64,11 @@ function build_plat_wheels {
local docker_image=quay.io/pypa/manylinux1_$plat local docker_image=quay.io/pypa/manylinux1_$plat
docker pull $docker_image docker pull $docker_image
if [ "$plat" == "i686" ]; then local intro_cmd=linux32; fi if [ "$plat" == "i686" ]; then local intro_cmd=linux32; fi
local widths=$(valid_unicode_widths $TRAVIS_PYTHON_VERSION $UNICODE_WIDTHS)
docker run --rm \ docker run --rm \
-e UTIL_DIR="$UTIL_DIR" \ -e UTIL_DIR="$UTIL_DIR" \
-e PYTHON_VERSION="$TRAVIS_PYTHON_VERSION" \ -e PYTHON_VERSION="$TRAVIS_PYTHON_VERSION" \
-e UNICODE_WIDTHS="$UNICODE_WIDTHS" \ -e UNICODE_WIDTHS="$widths" \
-e BUILD_DEPENDS="$BUILD_DEPENDS" \ -e BUILD_DEPENDS="$BUILD_DEPENDS" \
-e BUILD_COMMIT="$BUILD_COMMIT" \ -e BUILD_COMMIT="$BUILD_COMMIT" \
-e BUILD_PRE_SCRIPT="$BUILD_PRE_SCRIPT" \ -e BUILD_PRE_SCRIPT="$BUILD_PRE_SCRIPT" \
......
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