From 6a4773ac93e7a4649d0e80e7af1fd098c14325c2 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Wed, 27 Jan 2021 23:01:09 +0000 Subject: [PATCH] tests: Fix virtualenv creation on MacOS/OSX --- .ci/azure-pipelines-steps.yml | 28 ++++++++++++++++++---------- .ci/azure-pipelines.yml | 4 ++-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.ci/azure-pipelines-steps.yml b/.ci/azure-pipelines-steps.yml index 08b028b6..43eda90f 100644 --- a/.ci/azure-pipelines-steps.yml +++ b/.ci/azure-pipelines-steps.yml @@ -14,17 +14,25 @@ steps: # stuff into. The virtualenv can probably be removed again, but this was a # hard-fought battle and for now I am tired of this crap. - script: | - # need wheel before building virtualenv because of bdist_wheel and setuptools deps - # Mac's System Integrity Protection prevents symlinking /usr/bin - # and Azure isn't allowing disabling it apparently: https://developercommunityapi.westus.cloudapp.azure.com/idea/558702/allow-disabling-sip-on-microsoft-hosted-macos-agen.html - # the || will activate when running python3 tests # TODO: get python3 tests passing - (sudo ln -fs /usr/bin/python$(python.version) /usr/bin/python && - /usr/bin/python -m pip install -U pip wheel setuptools && - /usr/bin/python -m pip install -U virtualenv && - /usr/bin/python -m virtualenv /tmp/venv -p /usr/bin/python$(python.version)) || - (sudo /usr/bin/python$(python.version) -m pip install -U pip wheel setuptools && - /usr/bin/python$(python.version) -m venv /tmp/venv) + set -o errexit + set -o nounset + set -o pipefail + set -x + + # Ensure virtualenv is in system-wide $PATH on OSX, for Ansible test tasks + # that use it, e.g. regression/issue_152__virtualenv_python_fails.yml + if [[ -d /Library/Frameworks/Python.framework/Versions/2.7/bin ]]; then + echo $PATH + which python + python -m pip install -U pip virtualenv + ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv /usr/local/bin/virtualenv + virtualenv --version + fi + + # Create virtualenv using desired Python version, to run the testcases + python$(python.version) -m pip install -U pip wheel setuptools virtualenv + python$(python.version) -m virtualenv /tmp/venv -p python$(python.version) echo "##vso[task.prependpath]/tmp/venv/bin" displayName: activate venv diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index c23974df..a537b0f5 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -13,10 +13,10 @@ jobs: strategy: matrix: Mito27_27: - python.version: '2.7.18' + python.version: '2.7' MODE: mitogen Ans288_27: - python.version: '2.7.18' + python.version: '2.7' MODE: localhost_ansible VER: 2.8.8