Skip to content

Commit

Permalink
tools: add ensurepip
Browse files Browse the repository at this point in the history
  • Loading branch information
georgik committed Mar 6, 2023
1 parent f23c73e commit a4e80e7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Bundle-Python.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ Remove-Item "${PythonDirectory}\python${ShortPythonVersion}.zip"
Remove-Item "${PythonDirectory}\python${ShortPythonVersion}._pth"
Remove-Item "python.zip"

# Virtualenv layer
Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -Out "get-pip.py"
& .\${PythonDirectory}\python.exe "get-pip.py"
& .\${PythonDirectory}\python.exe -m pip install ensurepip

if ($True -eq $InstallVirtualenv) {
& .\${PythonDirectory}\python.exe -m pip install virtualenv
}
Expand All @@ -48,6 +43,7 @@ if ($null -eq (Get-Command "python.exe" -ErrorAction SilentlyContinue)) {
$SystemPythonPath = (Get-Command python).path
$PythonVenvScripts = Join-Path -Path (Split-Path $SystemPythonPath -Parent) -ChildPath Lib\venv\scripts\nt
$VenvScripts = Join-Path -Path (Split-Path $SystemPythonPath -Parent) -ChildPath Lib\venv
$EnsurepipScripts = Join-Path -Path (Split-Path $SystemPythonPath -Parent) -ChildPath Lib\ensurepip
}

mkdir ${PythonDirectory}\Lib\venv\scripts\nt
Expand All @@ -56,5 +52,10 @@ Copy-Item ${PythonVenvScripts}\pythonw.exe ${PythonDirectory}\Lib\venv\scripts\n
Copy-Item ${VenvScripts}\__init__.py ${PythonDirectory}\Lib\venv\
Copy-Item ${VenvScripts}\__main__.py ${PythonDirectory}\Lib\venv\

mkdir ${PythonDirectory}\Lib\ensurepip
Copy-Item ${EnsurepipScripts}\__init__.py ${PythonDirectory}\Lib\ensurepip\
Copy-Item ${EnsurepipScripts}\__main__.py ${PythonDirectory}\Lib\ensurepip\
Copy-Item -Recurse ${EnsurepipScripts}\_bundled ${PythonDirectory}\Lib\ensurepip\

# Create final zip - GitHub performs compression of artifacts automatically
Compress-Archive -Path "python\*" -DestinationPath "python.zip"

0 comments on commit a4e80e7

Please sign in to comment.