Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Improve test-setup.sh for macos #611

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tools/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,29 @@ fi
# shellcheck disable=SC1091
. "${VIRTUAL_ENV}/bin/activate"

if [[ "$(which python3)" != ${VIRTUAL_ENV}/bin/python3 ]]; then
log warning "Virtualenv broken, trying to recreate it ..."
python3 -m venv --clear "${VIRTUAL_ENV}"
. "${VIRTUAL_ENV}/bin/activate"
if [[ "$(which python3)" != ${VIRTUAL_ENV}/bin/python3 ]]; then
log error "Virtualenv still broken."
exit 99
fi
fi
log notice "Upgrading pip ..."

python3 -m pip install -q -U pip

EE_VERSION=$(./tools/get-image-version)
if [[ $(uname || true) != MINGW* ]]; then # if we are not on pure Windows
URL="https://raw.githubusercontent.com/ansible/creator-ee/${EE_VERSION}/_build/requirements.txt"
log notice "Installing dependencies from .config/requirements.in and ${URL} loaded from .config/Containerfile ..."

if [[ "${OS:-}" == "darwin" ]]; then
log notice "MacOS detected, altering CFLAGS to avoid potential build failure due to https://github.com/ansible/pylibssh/issues/207 ..."
CFLAGS="-I $(brew --prefix)/include -I ext -L $(brew --prefix)/lib -lssh"
export CFLAGS
fi
python3 -m pip install -r "${URL}" -r .config/requirements.in
fi

Expand Down
Loading