mirror of
				https://kkgithub.com/actions/setup-python.git
				synced 2025-11-04 04:31:51 +08:00 
			
		
		
		
	Compare commits
	
		
			12 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0ebf233433 | |||
| 665cd78205 | |||
| 93cb78f17b | |||
| 7f80679172 | |||
| dc9de69ff3 | |||
| ba33a692f1 | |||
| 156361d073 | |||
| 9a115684c9 | |||
| 3a40ba0199 | |||
| fa17801fa7 | |||
| 6277dd1255 | |||
| 2b732b899c | 
							
								
								
									
										4
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							@ -23,10 +23,10 @@ jobs:
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - name: Set Node.js 12.x
 | 
			
		||||
      - name: Set Node.js 16.x
 | 
			
		||||
        uses: actions/setup-node@v1
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 12.x
 | 
			
		||||
          node-version: 16.x
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm ci
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							@ -21,7 +21,7 @@ jobs:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
			
		||||
        python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
 | 
			
		||||
        python-version: ['3.8', '3.9', 'pypy-3.7-v7.x']
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - name: Setup Python
 | 
			
		||||
@ -39,18 +39,18 @@ jobs:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
			
		||||
        python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
 | 
			
		||||
        python-version: ['3.8', '3.9', 'pypy-3.7-v7.x']
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - name: Install pipenv
 | 
			
		||||
        run: pipx install pipenv
 | 
			
		||||
      - name: Setup Python
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: ${{ matrix.python-version }}
 | 
			
		||||
          cache: 'pipenv'
 | 
			
		||||
      - name: Install pipenv
 | 
			
		||||
        run: pipx install pipenv
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: pipenv install flake8
 | 
			
		||||
        run: pipenv install numpy
 | 
			
		||||
 | 
			
		||||
  python-pip-dependencies-caching-path:
 | 
			
		||||
    name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
 | 
			
		||||
@ -59,7 +59,7 @@ jobs:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
			
		||||
        python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
 | 
			
		||||
        python-version: ['3.8', '3.9', 'pypy-3.7-v7.x']
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - name: Setup Python
 | 
			
		||||
@ -78,16 +78,16 @@ jobs:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
			
		||||
        python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
 | 
			
		||||
        python-version: ['3.8', '3.9', 'pypy-3.7-v7.x']
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - name: Install pipenv
 | 
			
		||||
        run: pipx install pipenv
 | 
			
		||||
      - name: Setup Python
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: ${{ matrix.python-version }}
 | 
			
		||||
          cache: 'pipenv'
 | 
			
		||||
          cache-dependency-path: '**/requirements-linux.txt'
 | 
			
		||||
      - name: Install pipenv
 | 
			
		||||
        run: pipx install pipenv
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: pipenv install flake8
 | 
			
		||||
        run: pipenv install numpy
 | 
			
		||||
							
								
								
									
										6
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							@ -14,11 +14,15 @@ jobs:
 | 
			
		||||
    name: Check licenses
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - name: Set Node.js 16.x
 | 
			
		||||
        uses: actions/setup-node@v2
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 16.x
 | 
			
		||||
      - run: npm ci
 | 
			
		||||
      - name: Install licensed
 | 
			
		||||
        run: |
 | 
			
		||||
          cd $RUNNER_TEMP
 | 
			
		||||
          curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
 | 
			
		||||
          curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
 | 
			
		||||
          sudo tar -xzf licensed.tar.gz
 | 
			
		||||
          sudo mv licensed /usr/local/bin/licensed
 | 
			
		||||
      - run: licensed status
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/test-python.yml
									
									
									
									
										vendored
									
									
								
							@ -91,23 +91,3 @@ jobs:
 | 
			
		||||
    - name: Run simple code
 | 
			
		||||
      run: python -c 'import math; print(math.factorial(5))'
 | 
			
		||||
 | 
			
		||||
  setup-pypy-legacy:
 | 
			
		||||
    name: Setup PyPy ${{ matrix.os }}
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [macos-10.15, windows-latest, ubuntu-18.04, ubuntu-20.04]
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Checkout
 | 
			
		||||
      uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
    - name: setup-python pypy3
 | 
			
		||||
      uses: ./
 | 
			
		||||
      with:
 | 
			
		||||
        python-version: 'pypy3'
 | 
			
		||||
 | 
			
		||||
    - name: setup-python pypy2
 | 
			
		||||
      uses: ./
 | 
			
		||||
      with:
 | 
			
		||||
        python-version: 'pypy2'
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							@ -19,13 +19,13 @@ jobs:
 | 
			
		||||
    - name: Checkout
 | 
			
		||||
      uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
    - name: Set Node.js 12.x
 | 
			
		||||
    - name: Set Node.js 16.x
 | 
			
		||||
      uses: actions/setup-node@v1
 | 
			
		||||
      with:
 | 
			
		||||
        node-version: 12.x
 | 
			
		||||
        node-version: 16.x
 | 
			
		||||
 | 
			
		||||
    - name: npm install
 | 
			
		||||
      run: npm install
 | 
			
		||||
    - name: npm ci
 | 
			
		||||
      run: npm ci
 | 
			
		||||
 | 
			
		||||
    - name: Lint
 | 
			
		||||
      run: npm run format-check
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								.licenses/npm/@types/node.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@types/node.dep.yml
									
									
									
										generated
									
									
									
								
							@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
name: "@types/node"
 | 
			
		||||
version: 12.20.36
 | 
			
		||||
version: 16.11.25
 | 
			
		||||
type: npm
 | 
			
		||||
summary: TypeScript definitions for Node.js
 | 
			
		||||
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								.licenses/npm/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
name: node-fetch
 | 
			
		||||
version: 2.6.6
 | 
			
		||||
version: 2.6.7
 | 
			
		||||
type: npm
 | 
			
		||||
summary: A light-weight module that brings window.fetch to node.js
 | 
			
		||||
homepage: https://github.com/bitinn/node-fetch
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								README.md
									
									
									
									
									
								
							@ -43,7 +43,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        python-version: [ '2.x', '3.x', 'pypy-2.7', 'pypy-3.6', 'pypy-3.7' ]
 | 
			
		||||
        python-version: [ '2.x', '3.x', 'pypy-2.7', 'pypy-3.7', 'pypy-3.8' ]
 | 
			
		||||
    name: Python ${{ matrix.python-version }} sample
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
@ -63,7 +63,7 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [ubuntu-latest, macos-latest, windows-latest]
 | 
			
		||||
        python-version: ['2.7', '3.6', '3.7', '3.8', 'pypy-2.7', 'pypy-3.6']
 | 
			
		||||
        python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', 'pypy-2.7', 'pypy-3.8']
 | 
			
		||||
        exclude:
 | 
			
		||||
          - os: macos-latest
 | 
			
		||||
            python-version: '3.8'
 | 
			
		||||
@ -76,7 +76,7 @@ jobs:
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: ${{ matrix.python-version }}
 | 
			
		||||
      - name: Display Python version
 | 
			
		||||
        run: python -c "import sys; print(sys.version)"
 | 
			
		||||
        run: python --version
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Download and set up a version of Python that does not come preinstalled on an image:
 | 
			
		||||
@ -87,7 +87,7 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        # in this example, there is a newer version already installed, 3.7.7, so the older version will be downloaded
 | 
			
		||||
        python-version: ['3.5', '3.6', '3.7.4', '3.8']
 | 
			
		||||
        python-version: ['3.7.4', '3.8', '3.9', '3.10']
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v2
 | 
			
		||||
    - uses: actions/setup-python@v2
 | 
			
		||||
@ -102,7 +102,7 @@ steps:
 | 
			
		||||
- uses: actions/checkout@v2
 | 
			
		||||
- uses: actions/setup-python@v2
 | 
			
		||||
  with:
 | 
			
		||||
    python-version: '3.9.0-beta.4'
 | 
			
		||||
    python-version: '3.11.0-alpha.1'
 | 
			
		||||
- run: python my_script.py
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -112,7 +112,7 @@ steps:
 | 
			
		||||
- uses: actions/checkout@v2
 | 
			
		||||
- uses: actions/setup-python@v2
 | 
			
		||||
  with:
 | 
			
		||||
    python-version: '3.9.0-alpha - 3.9.0' # SemVer's version range syntax
 | 
			
		||||
    python-version: '3.11.0-alpha - 3.11.0' # SemVer's version range syntax
 | 
			
		||||
- run: python my_script.py
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -125,9 +125,9 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        python-version:
 | 
			
		||||
        - 'pypy-3.6' # the latest available version of PyPy that supports Python 3.6
 | 
			
		||||
        - 'pypy-3.7' # the latest available version of PyPy that supports Python 3.7
 | 
			
		||||
        - 'pypy-3.7-v7.3.3' # Python 3.7 and PyPy 7.3.3
 | 
			
		||||
        - 'pypy-3.8' # the latest available version of PyPy that supports Python 3.8
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v2
 | 
			
		||||
    - uses: actions/setup-python@v2
 | 
			
		||||
@ -146,7 +146,7 @@ Check out our detailed guide on using [Python with GitHub Actions](https://help.
 | 
			
		||||
`setup-python` is able to configure Python from two sources:
 | 
			
		||||
 | 
			
		||||
- Preinstalled versions of Python in the tools cache on GitHub-hosted runners.
 | 
			
		||||
    - For detailed information regarding the available versions of Python that are installed see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
 | 
			
		||||
    - For detailed information regarding the available versions of Python that are installed, see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
 | 
			
		||||
    - For every minor version of Python, expect only the latest patch to be preinstalled.
 | 
			
		||||
    - If `3.8.1` is installed for example, and `3.8.2` is released, expect `3.8.1` to be removed and replaced by `3.8.2` in the tools cache.
 | 
			
		||||
    - If the exact patch version doesn't matter to you, specifying just the major and minor version will get you the latest preinstalled patch version. In the previous example, the version spec `3.8` will use the `3.8.2` Python version found in the cache.
 | 
			
		||||
@ -159,9 +159,9 @@ Check out our detailed guide on using [Python with GitHub Actions](https://help.
 | 
			
		||||
 `setup-python` is able to configure PyPy from two sources:
 | 
			
		||||
 | 
			
		||||
- Preinstalled versions of PyPy in the tools cache on GitHub-hosted runners
 | 
			
		||||
  - For detailed information regarding the available versions of PyPy that are installed see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
 | 
			
		||||
  - For detailed information regarding the available versions of PyPy that are installed, see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
 | 
			
		||||
  - For the latest PyPy release, all versions of Python are cached.
 | 
			
		||||
  - Cache is updated with a 1-2 week delay. If you specify the PyPy version as `pypy-3.6`, the cached version will be used although a newer version is available. If you need to start using the recently released version right after release, you should specify the exact PyPy version using `pypy-3.6-v7.3.3`.
 | 
			
		||||
  - Cache is updated with a 1-2 week delay. If you specify the PyPy version as `pypy-3.7`, the cached version will be used although a newer version is available. If you need to start using the recently released version right after release, you should specify the exact PyPy version using `pypy-3.7-v7.3.3`.
 | 
			
		||||
 | 
			
		||||
- Downloadable PyPy versions from the [official PyPy site](https://downloads.python.org/pypy/).
 | 
			
		||||
  - All available versions that we can download are listed in [versions.json](https://downloads.python.org/pypy/versions.json) file.
 | 
			
		||||
@ -198,8 +198,8 @@ The version of PyPy should be specified in the format `pypy-<python_version>[-v<
 | 
			
		||||
The `<pypy_version>` parameter is optional and can be skipped. The latest version will be used in this case.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
pypy-3.6 # the latest available version of PyPy that supports Python 3.6
 | 
			
		||||
pypy-3.7 # the latest available version of PyPy that supports Python 3.7
 | 
			
		||||
pypy-3.8 # the latest available version of PyPy that supports Python 3.8
 | 
			
		||||
pypy-2.7 # the latest available version of PyPy that supports Python 2.7
 | 
			
		||||
pypy-3.7-v7.3.3 # Python 3.7 and PyPy 7.3.3
 | 
			
		||||
pypy-3.7-v7.x # Python 3.7 and the latest available PyPy 7.x
 | 
			
		||||
@ -230,7 +230,6 @@ steps:
 | 
			
		||||
    python-version: '3.9'
 | 
			
		||||
    cache: 'pip'
 | 
			
		||||
- run: pip install -r requirements.txt
 | 
			
		||||
- run: pip test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**Caching pipenv dependencies:**
 | 
			
		||||
@ -244,7 +243,6 @@ steps:
 | 
			
		||||
    python-version: '3.9'
 | 
			
		||||
    cache: 'pipenv'
 | 
			
		||||
- run: pipenv install
 | 
			
		||||
- run: pipenv test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**Using wildcard patterns to cache dependencies**
 | 
			
		||||
@ -257,7 +255,6 @@ steps:
 | 
			
		||||
    cache: 'pip'
 | 
			
		||||
    cache-dependency-path: '**/requirements-dev.txt'
 | 
			
		||||
- run: pip install -r subdirectory/requirements-dev.txt
 | 
			
		||||
- run: pip test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**Using a list of file paths to cache dependencies**
 | 
			
		||||
@ -274,7 +271,6 @@ steps:
 | 
			
		||||
      server/app/Pipfile.lock
 | 
			
		||||
      __test__/app/Pipfile.lock
 | 
			
		||||
- run: pipenv install
 | 
			
		||||
- run: pipenv test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# Using `setup-python` with a self hosted runner
 | 
			
		||||
@ -304,7 +300,7 @@ If you are experiencing problems while configuring Python on your self-hosted ru
 | 
			
		||||
  - The user starting the runner is in the owning group, and the owning group has write permission.
 | 
			
		||||
  - All users have write permission.
 | 
			
		||||
- One quick way to grant access is to change the user and group of `/opt/hostedtoolcache` to be the same as the runners using `chown`.
 | 
			
		||||
    - `sudo chown runner-user:runner-group opt/hostedtoolcache/`.
 | 
			
		||||
    - `sudo chown runner-user:runner-group /opt/hostedtoolcache/`.
 | 
			
		||||
- If your runner is configured as a service and you run into problems, make sure the user that the service is running as is correct. For more information, you can [check the status of your self-hosted runner](https://help.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#checking-the-status-of-the-service).
 | 
			
		||||
 | 
			
		||||
### Mac
 | 
			
		||||
 | 
			
		||||
@ -92,15 +92,12 @@ describe('restore-cache', () => {
 | 
			
		||||
          dependencyFile
 | 
			
		||||
        );
 | 
			
		||||
        await cacheDistributor.restoreCache();
 | 
			
		||||
        let pythonKey = '';
 | 
			
		||||
        if (packageManager === 'pipenv') {
 | 
			
		||||
          pythonKey = `python-${pythonVersion}-`;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        expect(infoSpy).toHaveBeenCalledWith(
 | 
			
		||||
          `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${pythonKey}${packageManager}-${fileHash}`
 | 
			
		||||
          `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-python-${pythonVersion}-${packageManager}-${fileHash}`
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
      },
 | 
			
		||||
      30000
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    it.each([
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,7 @@ describe('Finder tests', () => {
 | 
			
		||||
    await io.mkdirP(pythonDir);
 | 
			
		||||
    fs.writeFileSync(`${pythonDir}.complete`, 'hello');
 | 
			
		||||
    // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
			
		||||
    await finder.findPythonVersion('3.x', 'x64');
 | 
			
		||||
    await finder.useCpythonVersion('3.x', 'x64');
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('Finds stable Python version if it is not installed, but exists in the manifest', async () => {
 | 
			
		||||
@ -52,7 +52,7 @@ describe('Finder tests', () => {
 | 
			
		||||
      fs.writeFileSync(`${pythonDir}.complete`, 'hello');
 | 
			
		||||
    });
 | 
			
		||||
    // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
			
		||||
    await finder.findPythonVersion('1.2.3', 'x64');
 | 
			
		||||
    await finder.useCpythonVersion('1.2.3', 'x64');
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('Finds pre-release Python version in the manifest', async () => {
 | 
			
		||||
@ -74,25 +74,17 @@ describe('Finder tests', () => {
 | 
			
		||||
      fs.writeFileSync(`${pythonDir}.complete`, 'hello');
 | 
			
		||||
    });
 | 
			
		||||
    // This will throw if it doesn't find it in the manifest (because no such version exists)
 | 
			
		||||
    await finder.findPythonVersion('1.2.3-beta.2', 'x64');
 | 
			
		||||
    await finder.useCpythonVersion('1.2.3-beta.2', 'x64');
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('Errors if Python is not installed', async () => {
 | 
			
		||||
    // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
			
		||||
    let thrown = false;
 | 
			
		||||
    try {
 | 
			
		||||
      await finder.findPythonVersion('3.300000', 'x64');
 | 
			
		||||
      await finder.useCpythonVersion('3.300000', 'x64');
 | 
			
		||||
    } catch {
 | 
			
		||||
      thrown = true;
 | 
			
		||||
    }
 | 
			
		||||
    expect(thrown).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('Finds PyPy if it is installed', async () => {
 | 
			
		||||
    const pythonDir: string = path.join(toolDir, 'PyPy', '2.0.0', 'x64');
 | 
			
		||||
    await io.mkdirP(pythonDir);
 | 
			
		||||
    fs.writeFileSync(`${pythonDir}.complete`, 'hello');
 | 
			
		||||
    // This will throw if it doesn't find it in the cache (because no such version exists)
 | 
			
		||||
    await finder.findPythonVersion('pypy2', 'x64');
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ outputs:
 | 
			
		||||
  python-version:
 | 
			
		||||
    description: "The installed python version. Useful when given a version range as input."
 | 
			
		||||
runs:
 | 
			
		||||
  using: 'node12'
 | 
			
		||||
  using: 'node16'
 | 
			
		||||
  main: 'dist/setup/index.js'
 | 
			
		||||
  post: 'dist/cache-save/index.js'
 | 
			
		||||
  post-if: success()
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										84
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										84
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							@ -34585,9 +34585,17 @@ AbortError.prototype = Object.create(Error.prototype);
 | 
			
		||||
AbortError.prototype.constructor = AbortError;
 | 
			
		||||
AbortError.prototype.name = 'AbortError';
 | 
			
		||||
 | 
			
		||||
const URL$1 = Url.URL || whatwgUrl.URL;
 | 
			
		||||
 | 
			
		||||
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
 | 
			
		||||
const PassThrough$1 = Stream.PassThrough;
 | 
			
		||||
const resolve_url = Url.resolve;
 | 
			
		||||
 | 
			
		||||
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
 | 
			
		||||
	const orig = new URL$1(original).hostname;
 | 
			
		||||
	const dest = new URL$1(destination).hostname;
 | 
			
		||||
 | 
			
		||||
	return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Fetch function
 | 
			
		||||
@ -34675,7 +34683,19 @@ function fetch(url, opts) {
 | 
			
		||||
				const location = headers.get('Location');
 | 
			
		||||
 | 
			
		||||
				// HTTP fetch step 5.3
 | 
			
		||||
				const locationURL = location === null ? null : resolve_url(request.url, location);
 | 
			
		||||
				let locationURL = null;
 | 
			
		||||
				try {
 | 
			
		||||
					locationURL = location === null ? null : new URL$1(location, request.url).toString();
 | 
			
		||||
				} catch (err) {
 | 
			
		||||
					// error here can only be invalid URL in Location: header
 | 
			
		||||
					// do not throw when options.redirect == manual
 | 
			
		||||
					// let the user extract the errorneous redirect URL
 | 
			
		||||
					if (request.redirect !== 'manual') {
 | 
			
		||||
						reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
 | 
			
		||||
						finalize();
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// HTTP fetch step 5.5
 | 
			
		||||
				switch (request.redirect) {
 | 
			
		||||
@ -34723,6 +34743,12 @@ function fetch(url, opts) {
 | 
			
		||||
							size: request.size
 | 
			
		||||
						};
 | 
			
		||||
 | 
			
		||||
						if (!isDomainOrSubdomain(request.url, locationURL)) {
 | 
			
		||||
							for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
 | 
			
		||||
								requestOpts.headers.delete(name);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
						// HTTP-redirect fetch step 9
 | 
			
		||||
						if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
 | 
			
		||||
							reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
 | 
			
		||||
@ -37154,6 +37180,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -37163,14 +37208,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.State = void 0;
 | 
			
		||||
const cache = __importStar(__webpack_require__(692));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
var State;
 | 
			
		||||
@ -45778,6 +45817,25 @@ module.exports = require("stream");
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -45787,17 +45845,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.run = void 0;
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const cache = __importStar(__webpack_require__(692));
 | 
			
		||||
const fs_1 = __importDefault(__webpack_require__(747));
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										350
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										350
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							@ -2028,6 +2028,25 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -2037,14 +2056,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.findPyPyInstallDirForWindows = exports.parsePyPyVersion = exports.findPyPyToolCache = exports.findPyPyVersion = void 0;
 | 
			
		||||
const path = __importStar(__webpack_require__(622));
 | 
			
		||||
const pypyInstall = __importStar(__webpack_require__(369));
 | 
			
		||||
const utils_1 = __webpack_require__(163);
 | 
			
		||||
@ -6177,17 +6190,30 @@ exports.NoopTracerProvider = NoopTracerProvider;
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_LINUX = exports.IS_WINDOWS = void 0;
 | 
			
		||||
const fs_1 = __importDefault(__webpack_require__(747));
 | 
			
		||||
const path = __importStar(__webpack_require__(622));
 | 
			
		||||
const semver = __importStar(__webpack_require__(876));
 | 
			
		||||
@ -6606,6 +6632,25 @@ const Range = __webpack_require__(124)
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -6615,13 +6660,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const finder = __importStar(__webpack_require__(927));
 | 
			
		||||
@ -6656,7 +6694,7 @@ function run() {
 | 
			
		||||
                    core.info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    const installed = yield finder.findPythonVersion(version, arch);
 | 
			
		||||
                    const installed = yield finder.useCpythonVersion(version, arch);
 | 
			
		||||
                    pythonVersion = installed.version;
 | 
			
		||||
                    core.info(`Successfully setup ${installed.impl} (${pythonVersion})`);
 | 
			
		||||
                }
 | 
			
		||||
@ -7120,6 +7158,25 @@ exports.isTokenCredential = isTokenCredential;
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -7129,13 +7186,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
@ -10461,6 +10511,25 @@ function logProxy(funcName, namespace, args) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -10470,17 +10539,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.findAssetForMacOrLinux = exports.findAssetForWindows = exports.isArchPresentForMacOrLinux = exports.isArchPresentForWindows = exports.pypyVersionToSemantic = exports.getPyPyBinaryPath = exports.findRelease = exports.installPyPy = void 0;
 | 
			
		||||
const path = __importStar(__webpack_require__(622));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const tc = __importStar(__webpack_require__(533));
 | 
			
		||||
@ -34440,6 +34503,25 @@ exports.SearchState = SearchState;
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -34449,13 +34531,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
@ -34463,16 +34538,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const glob = __importStar(__webpack_require__(281));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const exec = __importStar(__webpack_require__(986));
 | 
			
		||||
const child_process = __importStar(__webpack_require__(129));
 | 
			
		||||
const util_1 = __importDefault(__webpack_require__(669));
 | 
			
		||||
const path = __importStar(__webpack_require__(622));
 | 
			
		||||
const os_1 = __importDefault(__webpack_require__(87));
 | 
			
		||||
const cache_distributor_1 = __importDefault(__webpack_require__(435));
 | 
			
		||||
const utils_1 = __webpack_require__(163);
 | 
			
		||||
class PipCache extends cache_distributor_1.default {
 | 
			
		||||
    constructor(cacheDependencyPath = '**/requirements.txt') {
 | 
			
		||||
    constructor(pythonVersion, cacheDependencyPath = '**/requirements.txt') {
 | 
			
		||||
        super('pip', cacheDependencyPath);
 | 
			
		||||
        this.pythonVersion = pythonVersion;
 | 
			
		||||
    }
 | 
			
		||||
    getCacheGlobalDirectories() {
 | 
			
		||||
        return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
            const { stdout, stderr, exitCode } = yield exec.getExecOutput('pip cache dir');
 | 
			
		||||
            let exitCode = 1;
 | 
			
		||||
            let stdout = '';
 | 
			
		||||
            let stderr = '';
 | 
			
		||||
            // Add temporary fix for Windows
 | 
			
		||||
            // On windows it is necessary to execute through an exec
 | 
			
		||||
            // because the getExecOutput gives a non zero code or writes to stderr for pip 22.0.2,
 | 
			
		||||
            // or spawn must be started with the shell option enabled for getExecOutput
 | 
			
		||||
            // Related issue: https://github.com/actions/setup-python/issues/328
 | 
			
		||||
            if (utils_1.IS_WINDOWS) {
 | 
			
		||||
                const execPromisify = util_1.default.promisify(child_process.exec);
 | 
			
		||||
                ({ stdout: stdout, stderr: stderr } = yield execPromisify('pip cache dir'));
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                ({
 | 
			
		||||
                    stdout: stdout,
 | 
			
		||||
                    stderr: stderr,
 | 
			
		||||
                    exitCode: exitCode
 | 
			
		||||
                } = yield exec.getExecOutput('pip cache dir'));
 | 
			
		||||
            }
 | 
			
		||||
            if (exitCode && stderr) {
 | 
			
		||||
                throw new Error(`Could not get cache folder path for pip package manager`);
 | 
			
		||||
            }
 | 
			
		||||
@ -34487,8 +34584,8 @@ class PipCache extends cache_distributor_1.default {
 | 
			
		||||
    computeKeys() {
 | 
			
		||||
        return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
            const hash = yield glob.hashFiles(this.cacheDependencyPath);
 | 
			
		||||
            const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}-${hash}`;
 | 
			
		||||
            const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}`;
 | 
			
		||||
            const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
 | 
			
		||||
            const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`;
 | 
			
		||||
            return {
 | 
			
		||||
                primaryKey,
 | 
			
		||||
                restoreKey: [restoreKey]
 | 
			
		||||
@ -35405,6 +35502,25 @@ exports.listTar = listTar;
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -35414,14 +35530,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.State = void 0;
 | 
			
		||||
const cache = __importStar(__webpack_require__(692));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
var State;
 | 
			
		||||
@ -37136,9 +37246,17 @@ AbortError.prototype = Object.create(Error.prototype);
 | 
			
		||||
AbortError.prototype.constructor = AbortError;
 | 
			
		||||
AbortError.prototype.name = 'AbortError';
 | 
			
		||||
 | 
			
		||||
const URL$1 = Url.URL || whatwgUrl.URL;
 | 
			
		||||
 | 
			
		||||
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
 | 
			
		||||
const PassThrough$1 = Stream.PassThrough;
 | 
			
		||||
const resolve_url = Url.resolve;
 | 
			
		||||
 | 
			
		||||
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
 | 
			
		||||
	const orig = new URL$1(original).hostname;
 | 
			
		||||
	const dest = new URL$1(destination).hostname;
 | 
			
		||||
 | 
			
		||||
	return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Fetch function
 | 
			
		||||
@ -37226,7 +37344,19 @@ function fetch(url, opts) {
 | 
			
		||||
				const location = headers.get('Location');
 | 
			
		||||
 | 
			
		||||
				// HTTP fetch step 5.3
 | 
			
		||||
				const locationURL = location === null ? null : resolve_url(request.url, location);
 | 
			
		||||
				let locationURL = null;
 | 
			
		||||
				try {
 | 
			
		||||
					locationURL = location === null ? null : new URL$1(location, request.url).toString();
 | 
			
		||||
				} catch (err) {
 | 
			
		||||
					// error here can only be invalid URL in Location: header
 | 
			
		||||
					// do not throw when options.redirect == manual
 | 
			
		||||
					// let the user extract the errorneous redirect URL
 | 
			
		||||
					if (request.redirect !== 'manual') {
 | 
			
		||||
						reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
 | 
			
		||||
						finalize();
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// HTTP fetch step 5.5
 | 
			
		||||
				switch (request.redirect) {
 | 
			
		||||
@ -37274,6 +37404,12 @@ function fetch(url, opts) {
 | 
			
		||||
							size: request.size
 | 
			
		||||
						};
 | 
			
		||||
 | 
			
		||||
						if (!isDomainOrSubdomain(request.url, locationURL)) {
 | 
			
		||||
							for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
 | 
			
		||||
								requestOpts.headers.delete(name);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
						// HTTP-redirect fetch step 9
 | 
			
		||||
						if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
 | 
			
		||||
							reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
 | 
			
		||||
@ -43878,6 +44014,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getCacheDistributor = exports.PackageManagers = void 0;
 | 
			
		||||
const pip_cache_1 = __importDefault(__webpack_require__(394));
 | 
			
		||||
const pipenv_cache_1 = __importDefault(__webpack_require__(235));
 | 
			
		||||
var PackageManagers;
 | 
			
		||||
@ -43888,7 +44025,7 @@ var PackageManagers;
 | 
			
		||||
function getCacheDistributor(packageManager, pythonVersion, cacheDependencyPath) {
 | 
			
		||||
    switch (packageManager) {
 | 
			
		||||
        case PackageManagers.Pip:
 | 
			
		||||
            return new pip_cache_1.default(cacheDependencyPath);
 | 
			
		||||
            return new pip_cache_1.default(pythonVersion, cacheDependencyPath);
 | 
			
		||||
        case PackageManagers.Pipenv:
 | 
			
		||||
            return new pipenv_cache_1.default(pythonVersion, cacheDependencyPath);
 | 
			
		||||
        default:
 | 
			
		||||
@ -52241,6 +52378,25 @@ module.exports = diff
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -52250,14 +52406,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.installCpythonFromRelease = exports.findReleaseFromManifest = exports.MANIFEST_URL = void 0;
 | 
			
		||||
const path = __importStar(__webpack_require__(622));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const tc = __importStar(__webpack_require__(533));
 | 
			
		||||
@ -56932,6 +57082,25 @@ exports.Pattern = Pattern;
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
@ -56941,14 +57110,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
			
		||||
    result["default"] = mod;
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.pythonVersionToSemantic = exports.useCpythonVersion = void 0;
 | 
			
		||||
const os = __importStar(__webpack_require__(87));
 | 
			
		||||
const path = __importStar(__webpack_require__(622));
 | 
			
		||||
const utils_1 = __webpack_require__(163);
 | 
			
		||||
@ -56976,40 +57139,6 @@ function binDir(installDir) {
 | 
			
		||||
        return path.join(installDir, 'bin');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
// Note on the tool cache layout for PyPy:
 | 
			
		||||
// PyPy has its own versioning scheme that doesn't follow the Python versioning scheme.
 | 
			
		||||
// A particular version of PyPy may contain one or more versions of the Python interpreter.
 | 
			
		||||
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
 | 
			
		||||
// We only care about the Python version, so we don't use the PyPy version for the tool cache.
 | 
			
		||||
function usePyPy(majorVersion, architecture) {
 | 
			
		||||
    const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion);
 | 
			
		||||
    let installDir = findPyPy(architecture);
 | 
			
		||||
    if (!installDir && utils_1.IS_WINDOWS) {
 | 
			
		||||
        // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
 | 
			
		||||
        // On our Windows virtual environments, we only install an x86 version.
 | 
			
		||||
        // Fall back to x86.
 | 
			
		||||
        installDir = findPyPy('x86');
 | 
			
		||||
    }
 | 
			
		||||
    if (!installDir) {
 | 
			
		||||
        // PyPy not installed in $(Agent.ToolsDirectory)
 | 
			
		||||
        throw new Error(`PyPy ${majorVersion} not found`);
 | 
			
		||||
    }
 | 
			
		||||
    // For PyPy, Windows uses 'bin', not 'Scripts'.
 | 
			
		||||
    const _binDir = path.join(installDir, 'bin');
 | 
			
		||||
    // On Linux and macOS, the Python interpreter is in 'bin'.
 | 
			
		||||
    // On Windows, it is in the installation root.
 | 
			
		||||
    const pythonLocation = utils_1.IS_WINDOWS ? installDir : _binDir;
 | 
			
		||||
    core.exportVariable('pythonLocation', pythonLocation);
 | 
			
		||||
    core.addPath(installDir);
 | 
			
		||||
    core.addPath(_binDir);
 | 
			
		||||
    // Starting from PyPy 7.3.1, the folder that is used for pip and anything that pip installs should be "Scripts" on Windows.
 | 
			
		||||
    if (utils_1.IS_WINDOWS) {
 | 
			
		||||
        core.addPath(path.join(installDir, 'Scripts'));
 | 
			
		||||
    }
 | 
			
		||||
    const impl = 'pypy' + majorVersion.toString();
 | 
			
		||||
    core.setOutput('python-version', impl);
 | 
			
		||||
    return { impl: impl, version: versionFromPath(installDir) };
 | 
			
		||||
}
 | 
			
		||||
function useCpythonVersion(version, architecture) {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        const desugaredVersionSpec = desugarDevVersion(version);
 | 
			
		||||
@ -57059,6 +57188,7 @@ function useCpythonVersion(version, architecture) {
 | 
			
		||||
        return { impl: 'CPython', version: installed };
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.useCpythonVersion = useCpythonVersion;
 | 
			
		||||
/** Convert versions like `3.8-dev` to a version like `>= 3.8.0-a0`. */
 | 
			
		||||
function desugarDevVersion(versionSpec) {
 | 
			
		||||
    if (versionSpec.endsWith('-dev')) {
 | 
			
		||||
@ -57085,20 +57215,6 @@ function pythonVersionToSemantic(versionSpec) {
 | 
			
		||||
    return versionSpec.replace(prereleaseVersion, '$1-$2');
 | 
			
		||||
}
 | 
			
		||||
exports.pythonVersionToSemantic = pythonVersionToSemantic;
 | 
			
		||||
function findPythonVersion(version, architecture) {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        switch (version.toUpperCase()) {
 | 
			
		||||
            case 'PYPY2':
 | 
			
		||||
                return usePyPy('2', architecture);
 | 
			
		||||
            case 'PYPY3':
 | 
			
		||||
                // keep pypy3 pointing to 3.6 for backward compatibility
 | 
			
		||||
                return usePyPy('3.6', architecture);
 | 
			
		||||
            default:
 | 
			
		||||
                return yield useCpythonVersion(version, architecture);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.findPythonVersion = findPythonVersion;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11380
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										11380
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -5,7 +5,7 @@
 | 
			
		||||
  "description": "Setup python action",
 | 
			
		||||
  "main": "dist/index.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "build": "tsc",
 | 
			
		||||
    "build": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts",
 | 
			
		||||
    "format": "prettier --write \"{,!(node_modules)/**/}*.ts\"",
 | 
			
		||||
    "format-check": "prettier --check \"{,!(node_modules)/**/}*.ts\"",
 | 
			
		||||
    "release": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts && git add -f dist/",
 | 
			
		||||
@ -33,7 +33,7 @@
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/jest": "^27.0.2",
 | 
			
		||||
    "@types/node": "^12.20.36",
 | 
			
		||||
    "@types/node": "^16.11.25",
 | 
			
		||||
    "@types/semver": "^7.1.0",
 | 
			
		||||
    "@zeit/ncc": "^0.22.0",
 | 
			
		||||
    "husky": "^7.0.2",
 | 
			
		||||
@ -41,7 +41,7 @@
 | 
			
		||||
    "jest-circus": "^27.2.5",
 | 
			
		||||
    "prettier": "^2.0.2",
 | 
			
		||||
    "ts-jest": "^27.0.5",
 | 
			
		||||
    "typescript": "^3.8.3"
 | 
			
		||||
    "typescript": "^4.2.3"
 | 
			
		||||
  },
 | 
			
		||||
  "husky": {
 | 
			
		||||
    "skipCI": true,
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@ export function getCacheDistributor(
 | 
			
		||||
) {
 | 
			
		||||
  switch (packageManager) {
 | 
			
		||||
    case PackageManagers.Pip:
 | 
			
		||||
      return new PipCache(cacheDependencyPath);
 | 
			
		||||
      return new PipCache(pythonVersion, cacheDependencyPath);
 | 
			
		||||
    case PackageManagers.Pipenv:
 | 
			
		||||
      return new PipenvCache(pythonVersion, cacheDependencyPath);
 | 
			
		||||
    default:
 | 
			
		||||
 | 
			
		||||
@ -1,21 +1,42 @@
 | 
			
		||||
import * as glob from '@actions/glob';
 | 
			
		||||
import * as core from '@actions/core';
 | 
			
		||||
import * as exec from '@actions/exec';
 | 
			
		||||
 | 
			
		||||
import * as child_process from 'child_process';
 | 
			
		||||
import utils from 'util';
 | 
			
		||||
import * as path from 'path';
 | 
			
		||||
import os from 'os';
 | 
			
		||||
 | 
			
		||||
import CacheDistributor from './cache-distributor';
 | 
			
		||||
import {IS_WINDOWS} from '../utils';
 | 
			
		||||
 | 
			
		||||
class PipCache extends CacheDistributor {
 | 
			
		||||
  constructor(cacheDependencyPath: string = '**/requirements.txt') {
 | 
			
		||||
  constructor(
 | 
			
		||||
    private pythonVersion: string,
 | 
			
		||||
    cacheDependencyPath: string = '**/requirements.txt'
 | 
			
		||||
  ) {
 | 
			
		||||
    super('pip', cacheDependencyPath);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected async getCacheGlobalDirectories() {
 | 
			
		||||
    const {stdout, stderr, exitCode} = await exec.getExecOutput(
 | 
			
		||||
      'pip cache dir'
 | 
			
		||||
    );
 | 
			
		||||
    let exitCode = 1;
 | 
			
		||||
    let stdout = '';
 | 
			
		||||
    let stderr = '';
 | 
			
		||||
 | 
			
		||||
    // Add temporary fix for Windows
 | 
			
		||||
    // On windows it is necessary to execute through an exec
 | 
			
		||||
    // because the getExecOutput gives a non zero code or writes to stderr for pip 22.0.2,
 | 
			
		||||
    // or spawn must be started with the shell option enabled for getExecOutput
 | 
			
		||||
    // Related issue: https://github.com/actions/setup-python/issues/328
 | 
			
		||||
    if (IS_WINDOWS) {
 | 
			
		||||
      const execPromisify = utils.promisify(child_process.exec);
 | 
			
		||||
      ({stdout: stdout, stderr: stderr} = await execPromisify('pip cache dir'));
 | 
			
		||||
    } else {
 | 
			
		||||
      ({
 | 
			
		||||
        stdout: stdout,
 | 
			
		||||
        stderr: stderr,
 | 
			
		||||
        exitCode: exitCode
 | 
			
		||||
      } = await exec.getExecOutput('pip cache dir'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (exitCode && stderr) {
 | 
			
		||||
      throw new Error(
 | 
			
		||||
@ -36,8 +57,8 @@ class PipCache extends CacheDistributor {
 | 
			
		||||
 | 
			
		||||
  protected async computeKeys() {
 | 
			
		||||
    const hash = await glob.hashFiles(this.cacheDependencyPath);
 | 
			
		||||
    const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}-${hash}`;
 | 
			
		||||
    const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}`;
 | 
			
		||||
    const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
 | 
			
		||||
    const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`;
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
      primaryKey,
 | 
			
		||||
 | 
			
		||||
@ -30,52 +30,7 @@ function binDir(installDir: string): string {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Note on the tool cache layout for PyPy:
 | 
			
		||||
// PyPy has its own versioning scheme that doesn't follow the Python versioning scheme.
 | 
			
		||||
// A particular version of PyPy may contain one or more versions of the Python interpreter.
 | 
			
		||||
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
 | 
			
		||||
// We only care about the Python version, so we don't use the PyPy version for the tool cache.
 | 
			
		||||
function usePyPy(
 | 
			
		||||
  majorVersion: '2' | '3.6',
 | 
			
		||||
  architecture: string
 | 
			
		||||
): InstalledVersion {
 | 
			
		||||
  const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion);
 | 
			
		||||
  let installDir: string | null = findPyPy(architecture);
 | 
			
		||||
 | 
			
		||||
  if (!installDir && IS_WINDOWS) {
 | 
			
		||||
    // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
 | 
			
		||||
    // On our Windows virtual environments, we only install an x86 version.
 | 
			
		||||
    // Fall back to x86.
 | 
			
		||||
    installDir = findPyPy('x86');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (!installDir) {
 | 
			
		||||
    // PyPy not installed in $(Agent.ToolsDirectory)
 | 
			
		||||
    throw new Error(`PyPy ${majorVersion} not found`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // For PyPy, Windows uses 'bin', not 'Scripts'.
 | 
			
		||||
  const _binDir = path.join(installDir, 'bin');
 | 
			
		||||
 | 
			
		||||
  // On Linux and macOS, the Python interpreter is in 'bin'.
 | 
			
		||||
  // On Windows, it is in the installation root.
 | 
			
		||||
  const pythonLocation = IS_WINDOWS ? installDir : _binDir;
 | 
			
		||||
  core.exportVariable('pythonLocation', pythonLocation);
 | 
			
		||||
 | 
			
		||||
  core.addPath(installDir);
 | 
			
		||||
  core.addPath(_binDir);
 | 
			
		||||
  // Starting from PyPy 7.3.1, the folder that is used for pip and anything that pip installs should be "Scripts" on Windows.
 | 
			
		||||
  if (IS_WINDOWS) {
 | 
			
		||||
    core.addPath(path.join(installDir, 'Scripts'));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const impl = 'pypy' + majorVersion.toString();
 | 
			
		||||
  core.setOutput('python-version', impl);
 | 
			
		||||
 | 
			
		||||
  return {impl: impl, version: versionFromPath(installDir)};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function useCpythonVersion(
 | 
			
		||||
export async function useCpythonVersion(
 | 
			
		||||
  version: string,
 | 
			
		||||
  architecture: string
 | 
			
		||||
): Promise<InstalledVersion> {
 | 
			
		||||
@ -186,18 +141,3 @@ export function pythonVersionToSemantic(versionSpec: string) {
 | 
			
		||||
  const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g;
 | 
			
		||||
  return versionSpec.replace(prereleaseVersion, '$1-$2');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function findPythonVersion(
 | 
			
		||||
  version: string,
 | 
			
		||||
  architecture: string
 | 
			
		||||
): Promise<InstalledVersion> {
 | 
			
		||||
  switch (version.toUpperCase()) {
 | 
			
		||||
    case 'PYPY2':
 | 
			
		||||
      return usePyPy('2', architecture);
 | 
			
		||||
    case 'PYPY3':
 | 
			
		||||
      // keep pypy3 pointing to 3.6 for backward compatibility
 | 
			
		||||
      return usePyPy('3.6', architecture);
 | 
			
		||||
    default:
 | 
			
		||||
      return await useCpythonVersion(version, architecture);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ async function run() {
 | 
			
		||||
          `Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
 | 
			
		||||
        );
 | 
			
		||||
      } else {
 | 
			
		||||
        const installed = await finder.findPythonVersion(version, arch);
 | 
			
		||||
        const installed = await finder.useCpythonVersion(version, arch);
 | 
			
		||||
        pythonVersion = installed.version;
 | 
			
		||||
        core.info(`Successfully setup ${installed.impl} (${pythonVersion})`);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user