Files
loci/scripts/requirements.sh
Chris Hoge d0ef425ef6 Clean up comment style and identify bugs and workarounds
Cleans up the comment style to remove author names and clarify
the comment as it relates to the code. Using the NOTE (NAME):
format is redundant and takes away attention from the purpose
of documenting why an action is being taken.

Also updates status of TODO and FIXME items, including removing
code was a workaround fixed by a recent patch.

Change-Id: I2e087be1e204c618d1dbe499b3f69eae34ce656f
2018-10-25 11:33:25 -07:00

65 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
set -eux
$(dirname $0)/setup_pip.sh
pip install bindep
$(dirname $0)/install_packages.sh
$(dirname $0)/clone_project.sh
mv /tmp/requirements/{global-requirements.txt,upper-constraints.txt} /
# TODO: Make python-qpid-proton build here (possibly patch it)
# or remove when python-qpid-proton is updated with build fix.
# https://issues.apache.org/jira/browse/PROTON-1381
if (( $(openssl version | awk -F'[ .]' '{print $3}') >= 1 )); then
sed -i '/python-qpid-proton/d' /upper-constraints.txt
fi
if [[ "${PYTHON3}" == "no" ]]; then
ignore_wheels=py2
else
ignore_wheels=py3
fi
pushd $(mktemp -d)
# Build all dependencies in parallel. This is safe because we are
# constrained on the version and we are building with --no-deps
export CASS_DRIVER_BUILD_CONCURRENCY=8
# Drop python packages requested by monasca_analytics. Their
# build time is huge and on !x86 we do not get binaries from Pypi.
egrep -v "(scipy|scikit-learn)" /upper-constraints.txt | split -l1
# When a package uses the variable 'setup_requires' in 'setup.py',
# 'pip wheel' dependency management will be overridden, resulting in
# possible incompatibilities between packages. Installing packages using
# upper-constraints.txt before building the wheels ensures the correct
# package versions will be available and installed locally.
# https://pip.readthedocs.io/en/stable/user_guide/#installation-bundles
# This allows to work around such issues as
# https://github.com/lxc/pylxd/issues/308
if [ ! -z "${PIP_PACKAGES}" ]; then
pip install -c /upper-constraints.txt ${PIP_PACKAGES}
fi
echo uwsgi enum-compat ${PIP_PACKAGES} | xargs -n1 | split -l1 -a3
ls -1 | xargs -n1 -P20 -t bash -c 'pip wheel --no-deps --wheel-dir / -c /upper-constraints.txt -r $1 || echo %1 >> /failure' _ | tee /tmp/wheels.txt
# TODO: Improve the failure catching
if [[ -f /failure ]]; then
echo Wheel failed to build
cat /failure
exit 1
fi
# Remove native-binary wheels, we only want to keep wheels that we
# compiled ourselves.
awk -F'[ ,]+' '/^Skipping/ {gsub("-","_");print $2}' /tmp/wheels.txt | xargs -r -n1 bash -c 'ls /$1-*' _ | sort -u | xargs -t -r rm
# Purge all files that are not wheels or txt to reduce the size of the
# layer to only what is needed
shopt -s extglob
rm -rf /!(*whl|*txt) > /dev/null 2>&1 || :