Skip to content

Commit 96426eb

Browse files
committed
tools: venv still requires binary from outside
1 parent 3821f5b commit 96426eb

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

Bundle-Python.ps1

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,28 @@ Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -Out "get-pip.py"
2828

2929
if ($True -eq $InstallVirtualenv) {
3030
& .\${PythonDirectory}\python.exe -m pip install virtualenv
31+
}
3132

32-
# Virtualenv helper files must be extracted from main python.
33-
# Embedded version does not contain working copy for virtualenv.
34-
# If Python is not available then install one
35-
if ($null -eq (Get-Command "python.exe" -ErrorAction SilentlyContinue)) {
36-
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/${PythonVersion}/python-${PythonVersion}-amd64.exe" -Out "python-amd64.exe"
37-
.\python-amd64.exe /quiet /passive TargetDir=${pwd}\temp-python3
38-
$InstallerProcess = Get-Process python-amd64
39-
Wait-Process -Id $InstallerProcess.id
40-
$PythonVenvScripts = temp-python3\Lib\venv\scripts\nt
41-
} else {
33+
# Venv helper files must be extracted from main python.
34+
# Embedded version does not contain working copy for virtualenv.
35+
# If Python is not available then install one
36+
if ($null -eq (Get-Command "python.exe" -ErrorAction SilentlyContinue)) {
37+
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/${PythonVersion}/python-${PythonVersion}-amd64.exe" -Out "python-amd64.exe"
38+
.\python-amd64.exe /quiet /passive TargetDir=${pwd}\temp-python3
39+
$InstallerProcess = Get-Process python-amd64
40+
Wait-Process -Id $InstallerProcess.id
41+
$PythonVenvScripts = temp-python3\Lib\venv\scripts\nt
42+
} else {
43+
if ($True -eq $InstallVirtualenv) {
4244
python -m pip install virtualenv
4345
python -m virtualenv temp-python3
44-
$PythonVenvScripts = "temp-python3\Scripts"
4546
}
46-
mkdir ${PythonDirectory}\Lib\venv\scripts\nt
47-
Copy-Item ${PythonVenvScripts}\python.exe ${PythonDirectory}\Lib\venv\scripts\nt
48-
Copy-Item ${PythonVenvScripts}\pythonw.exe ${PythonDirectory}\Lib\venv\scripts\nt
47+
$PythonVenvScripts = "temp-python3\Scripts"
4948
}
5049

50+
mkdir ${PythonDirectory}\Lib\venv\scripts\nt
51+
Copy-Item ${PythonVenvScripts}\python.exe ${PythonDirectory}\Lib\venv\scripts\nt
52+
Copy-Item ${PythonVenvScripts}\pythonw.exe ${PythonDirectory}\Lib\venv\scripts\nt
53+
5154
# Create final zip - GitHub performs compression of artifacts automatically
5255
Compress-Archive -Path "python\*" -DestinationPath "python.zip"

0 commit comments

Comments
 (0)