Commit 6de1a191 authored by Matthew Brett's avatar Matthew Brett
Browse files

More refactoring to improve configuration

parent 09a31790
...@@ -59,12 +59,3 @@ function install_wheel { ...@@ -59,12 +59,3 @@ function install_wheel {
pip install --find-links $MANYLINUX_URL $@ \ pip install --find-links $MANYLINUX_URL $@ \
$(python $MULTIBUILD_DIR/supported_wheels.py $wheelhouse/*.whl) $(python $MULTIBUILD_DIR/supported_wheels.py $wheelhouse/*.whl)
} }
function install_run {
# Depend on function `run_tests` defined in `config_funcs.sh`
install_wheel
# Configuration for this package
source $(get_root)/config_funcs.sh
mkdir tmp_for_test
(cd tmp_for_test && run_tests)
}
...@@ -6,4 +6,10 @@ set -e ...@@ -6,4 +6,10 @@ set -e
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}") MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh source $MULTIBUILD_DIR/common_utils.sh
install_run # Configuration for this package
# This can ovverride `install_wheel`, otherwise defined in common_utils.sh.
# It must define `run_tests`.
source $(get_root)/config_funcs.sh
install_wheel
run_tests
#!/bin/bash #!/bin/bash
# Wheel build, install, run test steps on Linux # Wheel build, install, run test steps on Linux
#
# In fact the main work is to wrap up the real functions in docker commands.
# The real work is in the BUILD_SCRIPT (which builds the wheel) and
# `docker_install_run.sh`, which can be configured with `config_funcs.sh`.
#
# Must define
# before_install
# build_wheel
# install_run
set -e set -e
# Get our own location on this filesystem # Get our own location on this filesystem
...@@ -11,6 +20,7 @@ BUILD_SCRIPT=${BUILD_SCRIPT:-${MULTIBUILD_DIR}/docker_build_package.sh} ...@@ -11,6 +20,7 @@ BUILD_SCRIPT=${BUILD_SCRIPT:-${MULTIBUILD_DIR}/docker_build_package.sh}
UNICODE_WIDTH=${UNICODE_WIDTH:-32} UNICODE_WIDTH=${UNICODE_WIDTH:-32}
function before_install { function before_install {
# Install a virtualenv to work in.
virtualenv --python=python venv virtualenv --python=python venv
source venv/bin/activate source venv/bin/activate
python --version # just to check python --version # just to check
...@@ -44,10 +54,6 @@ function build_wheel { ...@@ -44,10 +54,6 @@ function build_wheel {
$docker_image /io/$BUILD_SCRIPT $docker_image /io/$BUILD_SCRIPT
} }
function relpath {
python -c "import os.path; print(os.path.relpath('$1','${2:-$PWD}'))"
}
function install_run { function install_run {
local plat=${1:-$PLAT} local plat=${1:-$PLAT}
bitness=$([ "$plat" == i686 ] && echo 32 || echo 64) bitness=$([ "$plat" == i686 ] && echo 32 || echo 64)
......
...@@ -6,8 +6,7 @@ set -e ...@@ -6,8 +6,7 @@ set -e
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}") MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/osx_utils.sh source $MULTIBUILD_DIR/osx_utils.sh
# Local configuration may define custom pre-build, source patching # NB - config_funcs.sh sourced at end of this function
source $PWD/config_funcs.sh
function before_install { function before_install {
export CC=clang export CC=clang
...@@ -17,6 +16,14 @@ function before_install { ...@@ -17,6 +16,14 @@ function before_install {
pip install --upgrade pip wheel pip install --upgrade pip wheel
} }
function delocate_wheel {
local wheelhouse=$PWD/$WHEEL_SDIR
pip install delocate
delocate-listdeps $wheelhouse/*.whl # lists library dependencies
delocate-wheel $wheelhouse/*.whl # copies library dependencies into wheel
delocate-addplat --rm-orig -x 10_9 -x 10_10 $wheelhouse/*.whl
}
function build_wheel { function build_wheel {
# Builds wheel, puts into $WHEEL_SDIR # Builds wheel, puts into $WHEEL_SDIR
# #
...@@ -35,8 +42,16 @@ function build_wheel { ...@@ -35,8 +42,16 @@ function build_wheel {
else else
pip wheel -w $wheelhouse --no-deps $PKG_SPEC pip wheel -w $wheelhouse --no-deps $PKG_SPEC
fi fi
pip install delocate delocate_wheel
delocate-listdeps $wheelhouse/*.whl # lists library dependencies
delocate-wheel $wheelhouse/*.whl # copies library dependencies into wheel
delocate-addplat --rm-orig -x 10_9 -x 10_10 $wheelhouse/*.whl
} }
function install_run {
# Depend on function `run_tests` defined in `config_funcs.sh`
install_wheel
mkdir tmp_for_test
(cd tmp_for_test && run_tests)
}
# Local configuration may define custom pre-build, source patching.
# It can also overwrite the functions above
source $PWD/config_funcs.sh
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