File tree Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,42 @@ jobs:
31
31
32
32
- uses : actions/checkout@v3
33
33
34
- - name : Setup python
35
- id : python
34
+ # Python 2.7 was removed from actions/setup-python https://github.com/actions/setup-python/issues/672
35
+ - name : Set up Python ${{ matrix.python-version }}
36
+ if : matrix.python-version != '2.7'
36
37
uses : actions/setup-python@v4
38
+ id : setup-python
37
39
with :
38
40
python-version : ${{ matrix.python-version }}
39
41
architecture : x64
40
42
43
+ - name : Set up Python ${{ matrix.python-version }}
44
+ if : matrix.python-version == '2.7' && matrix.os == 'ubuntu-20.04'
45
+ run : |
46
+ sudo apt install -y python2
47
+ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
48
+ sudo python2 get-pip.py
49
+ id : apt-install-python
50
+
51
+ - name : Set up Python ${{ matrix.python-version }}
52
+ if : matrix.python-version == '2.7' && matrix.os == 'windows-latest'
53
+ run : |
54
+ choco install python2
55
+ id : choco-install-python
56
+ shell : pwsh
57
+
58
+ - name : Configure steps.python.outputs
59
+ run : |
60
+ if (Test-Path "${{ steps.setup-python.outputs.python-path }}") {
61
+ "python-path=${{ steps.setup-python.outputs.python-path }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
62
+ } elseif (Test-Path C:/Python27/python.exe) {
63
+ "python-path=C:/Python27/python.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
64
+ } else {
65
+ "python-path=/usr/bin/python2.7" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
66
+ }
67
+ id : python
68
+ shell : pwsh
69
+
41
70
# Cannot use https://github.com/ilammy/msvc-dev-cmd/blob/a742a854f54111d83b78e97091b5d85ccdaa3e89/index.js#L163
42
71
# as (unapproved) 3rd party GitHub Actions are forbidden on Apache org projects
43
72
You can’t perform that action at this time.
0 commit comments