diff --git a/action.yml b/action.yml index 7b1fba5..3f61de4 100644 --- a/action.yml +++ b/action.yml @@ -39,6 +39,10 @@ inputs: freethreaded: description: "When 'true', use the freethreaded version of Python." default: false + pip-version: + description: "Used to specify the version of pip to install with the Python. Supported format: major[.minor][.patch]." + pip-install: + description: "Used to specify the packages to install with pip after setting up Python. Can be a requirements file or package names." outputs: python-version: description: "The installed Python or PyPy version. Useful when given a version range as input." @@ -75,8 +79,5 @@ runs: cache-dependency-path: ${{ inputs.cache-dependency-path }} update-environment: ${{ inputs.update-environment }} freethreaded: ${{ steps.build.outputs.freethreaded }} - - run: ${{ github.action_path }}/setup_pip.ps1 - shell: pwsh - env: - PYTHON_VERSION: ${{ steps.setup.outputs.python-version }} - SETUP_PYTHON_PATH: ${{ steps.setup.outputs.python-path }} \ No newline at end of file + pip-version: ${{ inputs.pip-version }} + pip-install: ${{ inputs.pip-install }} \ No newline at end of file diff --git a/setup_pip.ps1 b/setup_pip.ps1 deleted file mode 100644 index 66e371d..0000000 --- a/setup_pip.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -$Version = $env:PYTHON_VERSION -$PythonPath = $env:SETUP_PYTHON_PATH -$Semver = $Version.Split('.') -Write-Output "Setting up pip for python $Version in path $PythonPath" -if (!($Semver[0] -like 'pypy*') -and ([int]$Semver[0] -eq 3 -and [int]$Semver[1] -lt 5)) { - if ([int]$Semver[1] -gt 2) { - Write-Output "Using get_pip.py..." - $VersionNumber = $Semver[0] - $Major = $Semver[1] - $GetPipFile = New-TemporaryFile - Invoke-WebRequest -Uri "https://bootstrap.pypa.io/pip/$VersionNumber.$Major/get-pip.py" -OutFile $GetPipFile - Invoke-Expression -Command "$PythonPath $GetPipFile" - Write-Output "Installing typing for old Python versions..." - Invoke-Expression -Command "$PythonPath -m pip install typing" - Remove-Item $GetPipFile - if ([int]$Semver[1] -eq 4) { - Invoke-Expression -Command "$PythonPath -m pip install --upgrade wheel setuptools" - } - } else { - Write-Output "Pip is not available for version $Version" - Write-Output "Proceed with manual installation at own risk" - } -} else { - Write-Output "Using ensurepip..." - Invoke-Expression -Command "$PythonPath -m ensurepip" - Invoke-Expression -Command "$PythonPath -m pip install --upgrade pip" - Write-Output "Installing wheel and setuptools..." - Invoke-Expression -Command "$PythonPath -m pip install --upgrade wheel setuptools" -} \ No newline at end of file