config-version.yml 1.89 KB
Newer Older
1
2
3
parameters:
- name: platform
  type: string
4
5
6
7
8
9
10
- name: python_env
  type: string
  default: default
  values:
  - default
  - noop
  - venv
11
12

steps:
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
44

# UsePythonVersion task only works when the specific Python version is already installed.

# The following is for linux.
# Reference: https://dev.to/akaszynski/create-an-azure-self-hosted-agent-without-going-insane-173g
# We only need Python 3.7 and 3.9 for now.
# --system-site-packages is required to make packages installed with --user visible to virtualenv.
- ${{ if contains(parameters.platform, 'legacy') }}:
    script: |
      set -e
      mkdir -p $(Agent.ToolsDirectory)/Python
      cd $(Agent.ToolsDirectory)/Python
      PY37_VER=$(python3.7 -c "import sys; print('.'.join([f'{val}' for val in sys.version_info[:3]]))")
      mkdir $PY37_VER
      ln -s $PY37_VER 3.7
      cd $PY37_VER
      python3.7 -m venv x64 --system-site-packages
      touch x64.complete
    displayName: Create Python 3.7 venv
  ${{ else }}:
    script: |
      set -e
      mkdir -p $(Agent.ToolsDirectory)/Python
      cd $(Agent.ToolsDirectory)/Python
      PY39_VER=$(python3.9 -c "import sys; print('.'.join([f'{val}' for val in sys.version_info[:3]]))")
      mkdir $PY39_VER
      ln -s $PY39_VER 3.9
      cd $PY39_VER
      python3.9 -m venv x64 --system-site-packages
      touch x64.complete
    displayName: Create Python 3.9 venv
  condition: and(succeeded(), eq('${{ parameters.python_env }}', 'venv'))
45
46
47

- task: UsePythonVersion@0
  inputs:
48
49
50
51
52
53
    ${{ if contains(parameters.platform, 'legacy') }}:
      versionSpec: 3.7
    ${{ else }}:
      versionSpec: 3.9
  displayName: Configure Python version
  condition: and(succeeded(), ne('${{ parameters.python_env }}', 'noop'))
54
55
56

- task: NodeTool@0
  inputs:
57
    versionSpec: 16.13.2
58
59
60
  displayName: Configure Node.js version

- script: |
liuzhe-lz's avatar
liuzhe-lz committed
61
    python -m pip install pip==22.0.4 setuptools==62.1.0 wheel==0.37.1
62
  displayName: Install PyPA tools