Skip to content

Commit 5786cad

Browse files
scbeddVinothini Dharmaraj
authored andcommitted
cherry picking the fa2bb49 to fix the python issue
1 parent 2b128a2 commit 5786cad

File tree

7 files changed

+73
-19
lines changed

7 files changed

+73
-19
lines changed

eng/ci_tools.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# requirements leveraged by ci tools
2-
setuptools==67.6.0; python_version >= '3.5'
3-
virtualenv==20.24.3
4-
wheel==0.37.0
2+
setuptools==69.2.0; python_version >= '3.5'
3+
virtualenv==20.25.1
4+
wheel==0.43.0
55
packaging==23.1
66
tox==4.5.0
77
pathlib2==2.3.5

eng/conda_test_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trio
88
typing_extensions>=3.7.2
99
cryptography
1010
adal
11-
setuptools==67.6.0; python_version >= '3.5'
11+
setuptools==69.2.0; python_version >= '3.5'
1212
pytest-asyncio==0.12.0
1313
-e sdk/core/azure-core/tests/testserver_tests/coretestserver
1414
azure-mgmt-storage

eng/pipelines/templates/steps/build-package-artifacts.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,25 @@ steps:
4949
inputs:
5050
versionSpec: $(PythonVersion)
5151

52+
53+
- template: /eng/pipelines/templates/steps/use-venv.yml
54+
parameters:
55+
VirtualEnvironmentName: "venv"
56+
Activate: false
57+
5258
- bash: |
53-
python -m venv $(Build.SourcesDirectory)/venv
54-
source $(Build.SourcesDirectory)/venv/bin/activate
59+
source $(VENV_LOCATION)/bin/activate
5560
which python
5661
python -m pip install --force -r eng/ci_tools.txt
5762
python -m pip freeze --all
58-
echo "##vso[task.setvariable variable=PATH]$PATH"
5963
displayName: 'Prep Environment Linux/Mac'
6064
condition: and(succeeded(), or(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OS'], 'Darwin')))
6165
6266
- pwsh: |
63-
python -m venv $(Build.SourcesDirectory)/venv
64-
./venv/Scripts/Activate.ps1
67+
. $(VENV_LOCATION)/Scripts/Activate.ps1
6568
which python
66-
python -m pip install --force -r eng\ci_tools.txt
69+
python -m pip install --force -r eng/ci_tools.txt
6770
python -m pip freeze --all
68-
69-
$path = $env:PATH
70-
Write-Host "##vso[task.setvariable variable=PATH]$path"
7171
displayName: 'Prep Environment Windows'
7272
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
7373
@@ -95,7 +95,7 @@ steps:
9595
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
9696
9797
- bash: |
98-
source $(Build.SourcesDirectory)/venv/bin/activate
98+
source $(VENV_LOCATION)/bin/activate
9999
which python
100100
sdk_build -d "$(Build.ArtifactStagingDirectory)" "$(TargetingString)" --service=${{parameters.ServiceDirectory}} --inactive
101101
displayName: 'Generate Packages Linux/Mac'
@@ -105,7 +105,7 @@ steps:
105105
CIBW_BUILD_VERBOSITY: 3
106106
107107
- pwsh: |
108-
./venv/Scripts/Activate.ps1
108+
. $(VENV_LOCATION)/Scripts/Activate.ps1
109109
which python
110110
sdk_build -d "$(Build.ArtifactStagingDirectory)" "$(TargetingString)" --service=${{parameters.ServiceDirectory}} --inactive
111111
displayName: 'Generate Packages Windows'

eng/pipelines/templates/steps/build-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ steps:
4040
$PSNativeCommandUseErrorActionPreference = $true
4141
python -m pip freeze
4242
python -m pip install pip==23.2.1
43-
python -m pip install setuptools==67.6.0
44-
python -m pip install wheel==0.37.0
43+
python -m pip install wheel==0.43.0 --force-reinstall
44+
python -m pip install setuptools==69.2.0 --force-reinstall
4545
python -m pip install -r eng/ci_tools.txt
4646
pip --version
4747
pip freeze
48-
displayName: 'Prep Environment'
48+
displayName: 'Prep Environment Linux/Mac'
4949
5050
- ${{if eq(parameters.TestProxy, true) }}:
5151
- template: /eng/common/testproxy/test-proxy-tool.yml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
parameters:
2+
- name: VirtualEnvironmentName
3+
type: string
4+
default: "venv"
5+
- name: Activate
6+
type: boolean
7+
default: true
8+
9+
steps:
10+
- pwsh: |
11+
$(Build.SourcesDirectory)/eng/scripts/create-venv.ps1 `
12+
-VenvName "${{ parameters.VirtualEnvironmentName }}" `
13+
-RepoRoot "$(Build.SourcesDirectory)"
14+
displayName: Create virtual environment
15+
16+
- ${{ if eq(parameters.Activate, true) }}:
17+
- pwsh: |
18+
$(Build.SourcesDirectory)/eng/scripts/activate-venv.ps1 `
19+
-VenvName "${{ parameters.VirtualEnvironmentName }}" `
20+
-RepoRoot "$(Build.SourcesDirectory)"
21+
displayName: Use ${{ parameters.VirtualEnvironmentName }} Virtual Environment

eng/regression_tools.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# requirements leveraged by ci tools
2-
setuptools==67.6.0; python_version >= '3.5'
2+
setuptools==69.2.0; python_version >= '3.5'
33
virtualenv==20.23.0
44
wheel==0.37.0
55
Jinja2==3.1.2

eng/scripts/create-venv.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<#!
2+
.SYNOPSIS
3+
Creates a virtual environment for a CI machine.
4+
5+
.DESCRIPTION
6+
If the virtual environment directory already exists, it will skip the creation. The location of the virtual environment will be stored in a variable
7+
named <VenvName>_LOCATION. The location will be RepoRoot + VenvName.
8+
9+
.PARAMETER VenvName
10+
The name of the virtual environment which will be created.
11+
12+
.PARAMETER RepoRoot
13+
The root of the repository.
14+
#>
15+
param(
16+
[Parameter(Mandatory = $true)]
17+
[string] $VenvName,
18+
# The root of the repository should be $(Build.SourcesDirectory) passed in from template
19+
[Parameter(Mandatory = $true)]
20+
[string] $RepoRoot
21+
)
22+
23+
$venvPath = Join-Path $RepoRoot $VenvName
24+
if (!(Test-Path $venvPath)) {
25+
Write-Host "Creating virtual environment '$VenvName'."
26+
python -m pip install virtualenv==20.25.1
27+
python -m virtualenv "$venvPath"
28+
Write-Host "Virtual environment '$VenvName' created."
29+
Write-Host "##vso[task.setvariable variable=$($VenvName)_LOCATION]$venvPath"
30+
}
31+
else {
32+
Write-Host "Virtual environment '$VenvName' already exists. Skipping creation."
33+
}

0 commit comments

Comments
 (0)