Skip to content

Commit 6a4773a

Browse files
committed
tests: Fix virtualenv creation on MacOS/OSX
1 parent 00e5c9c commit 6a4773a

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

.ci/azure-pipelines-steps.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,25 @@ steps:
1414
# stuff into. The virtualenv can probably be removed again, but this was a
1515
# hard-fought battle and for now I am tired of this crap.
1616
- script: |
17-
# need wheel before building virtualenv because of bdist_wheel and setuptools deps
18-
# Mac's System Integrity Protection prevents symlinking /usr/bin
19-
# 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
20-
# the || will activate when running python3 tests
2117
# TODO: get python3 tests passing
22-
(sudo ln -fs /usr/bin/python$(python.version) /usr/bin/python &&
23-
/usr/bin/python -m pip install -U pip wheel setuptools &&
24-
/usr/bin/python -m pip install -U virtualenv &&
25-
/usr/bin/python -m virtualenv /tmp/venv -p /usr/bin/python$(python.version)) ||
26-
(sudo /usr/bin/python$(python.version) -m pip install -U pip wheel setuptools &&
27-
/usr/bin/python$(python.version) -m venv /tmp/venv)
18+
set -o errexit
19+
set -o nounset
20+
set -o pipefail
21+
set -x
22+
23+
# Ensure virtualenv is in system-wide $PATH on OSX, for Ansible test tasks
24+
# that use it, e.g. regression/issue_152__virtualenv_python_fails.yml
25+
if [[ -d /Library/Frameworks/Python.framework/Versions/2.7/bin ]]; then
26+
echo $PATH
27+
which python
28+
python -m pip install -U pip virtualenv
29+
ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv /usr/local/bin/virtualenv
30+
virtualenv --version
31+
fi
32+
33+
# Create virtualenv using desired Python version, to run the testcases
34+
python$(python.version) -m pip install -U pip wheel setuptools virtualenv
35+
python$(python.version) -m virtualenv /tmp/venv -p python$(python.version)
2836
echo "##vso[task.prependpath]/tmp/venv/bin"
2937
3038
displayName: activate venv

.ci/azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
strategy:
1414
matrix:
1515
Mito27_27:
16-
python.version: '2.7.18'
16+
python.version: '2.7'
1717
MODE: mitogen
1818
Ans288_27:
19-
python.version: '2.7.18'
19+
python.version: '2.7'
2020
MODE: localhost_ansible
2121
VER: 2.8.8
2222

0 commit comments

Comments
 (0)