File: use-python-version.yml

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (43 lines) | stat: -rw-r--r-- 1,403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
parameters:
  versionSpec: ''

steps:
  # use python 3.8 for tooling. packaging. platform.
  - task: UsePythonVersion@0
    displayName: "Use Python 3.8"
    inputs:
      versionSpec: 3.8

  - pwsh: |
      pip install packaging==20.4
    displayName: Prep Environment

  # select the appropriate version from manifest if present
  - task: PythonScript@0
    displayName: 'Install ${{ parameters.versionSpec }} from Python Manifest If Necessary'
    inputs:
     scriptPath: 'scripts/devops_tasks/install_python_version.py'
     arguments: '${{ parameters.versionSpec }} --installer_folder="../_pyinstaller'

  # set up bypass of standard use python version
  - pwsh: |
      $incoming = "${{ parameters.versionSpec }}"

      if($incoming.Contains("pypy3")){
        Write-Host "##vso[task.setvariable variable=ManualInstallNecessary]true"
      } 
    displayName: Check UsePythonVersion Necessity

  - task: PythonScript@0
    displayName: 'PyPy3 Specific Path Prepend'
    condition: and(succeeded(), eq(variables.ManualInstallNecessary, 'true'))
    inputs:
      scriptPath: 'scripts/devops_tasks/use_pypy_version.py'
      arguments: '${{ parameters.versionSpec }}'

  # use
  - task: UsePythonVersion@0
    displayName: "Use Python $(PythonVersion)"
    condition: and(succeeded(), not(eq(variables.ManualInstallNecessary, 'true')))
    inputs:
      versionSpec: ${{ parameters.versionSpec }}