Skip to content

Commit

Permalink
[Azure Pipelines] Consistently use the "Use Python Version" task (#21722
Browse files Browse the repository at this point in the history
)

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-python-version?view=azure-devops

The default python/pip on the macOS VMs don't work any longer. It may be
possible to fix this, but to fix the urgent issue use the method
that's supported by Azure Pipelines.

The python version will remain unchanged at 2.7.17, but pip will
change from 19.3.1 to 20.0.2.

pip_install.yml can be simplified because the remaining code path is
the same for macOS and Windows.

Fixes #21691.
  • Loading branch information
foolip committed Feb 11, 2020
1 parent 68f01ac commit cd29a90
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
24 changes: 24 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
pool:
vmImage: 'macOS-10.14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/affected_tests.yml
parameters:
artifactName: 'safari-preview-affected-tests'
Expand All @@ -48,6 +51,9 @@ jobs:
pool:
vmImage: 'macOS-10.14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/affected_tests.yml
parameters:
checkoutCommit: 'HEAD^1'
Expand Down Expand Up @@ -82,6 +88,9 @@ jobs:
pool:
vmImage: 'macOS-10.14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/pip_install.yml
parameters:
Expand Down Expand Up @@ -114,6 +123,9 @@ jobs:
variables:
HYPOTHESIS_PROFILE: ci
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
Expand Down Expand Up @@ -161,6 +173,9 @@ jobs:
variables:
HYPOTHESIS_PROFILE: ci
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
Expand Down Expand Up @@ -209,6 +224,9 @@ jobs:
HYPOTHESIS_PROFILE: ci
steps:
# full checkout required
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/install_chrome.yml
- template: tools/ci/azure/install_firefox.yml
- template: tools/ci/azure/update_hosts.yml
Expand Down Expand Up @@ -594,6 +612,9 @@ jobs:
pool:
vmImage: 'macOS-10.14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/pip_install.yml
parameters:
Expand Down Expand Up @@ -628,6 +649,9 @@ jobs:
pool:
vmImage: 'macOS-10.14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7.x'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/pip_install.yml
parameters:
Expand Down
15 changes: 1 addition & 14 deletions tools/ci/azure/pip_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,5 @@ parameters:
packages: ''

steps:
- script: |
if [ `which pip` = '/usr/bin/pip' ]; then
# `sudo pip install` is not used because some packages (e.g. tox) depend on
# system packages (e.g. setuptools) which cannot be upgraded due to System
# Integrity Protection, see https://stackoverflow.com/a/33004920.
pip install --user ${{ parameters.packages }}
echo "##vso[task.prependpath]$HOME/Library/Python/2.7/bin"
else
pip --disable-pip-version-check install --upgrade ${{ parameters.packages }}
fi
displayName: 'Install Python packages (macOS)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
- script: pip --disable-pip-version-check install --upgrade ${{ parameters.packages }}
displayName: 'Install Python packages (Windows)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
displayName: 'Install Python packages'

0 comments on commit cd29a90

Please sign in to comment.