blob: 38d586dbfb6a21428a5cf88c0088a9cdb97297b7 [file] [log] [blame]
#!/usr/bin/env sh
# This script ensures that the 'lit' Python module is available for import. Both
# the XCTest adaptor and the "testing" build target using the module directly to
# run the Lit based tests.
set -e
# Check if the 'lit' module is available (e.g., in their user python path).
LIT_MODULE_PATH=$(python -c "import lit; print lit.__file__" 2> /dev/null || true)
if [ -z "${LIT_MODULE_PATH}" ]; then
# If not, attempt an automatic user easy_install of 'lit'.
INSTALL_LOG_PATH="${BUILT_PRODUCTS_DIR}/tests/lit.install.log"
echo "note: attempting automatic 'lit' install, see log at: '${INSTALL_LOG_PATH}'"
if ( ! easy_install --user lit &> ${INSTALL_LOG_PATH} ); then
echo "error: unable to automatically install, please consult \
log or install manually."
exit 1
fi
fi