Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fengzch-das
multibuild
Commits
00026e38
Commit
00026e38
authored
Jul 05, 2018
by
Matthew Brett
Browse files
Add script to install new Python on Appveyor
parent
99d8d0c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
install_python.ps1
install_python.ps1
+31
-0
No files found.
install_python.ps1
0 → 100644
View file @
00026e38
# Install specified Python version.
# Install only if:
# Our current matrix entry uses this Python version AND
# Python version is not already available.
$py_exe
=
"
${env:PYTHON}
\Python.exe"
if
(
[
System.IO.File
]::
Exists
(
$py_exe
)
)
{
exit
0
}
$req_nodot
=
$
env
:
PYTHON
-replace
'\D+Python(\d+)(?:-x64)?'
,
'$1'
$req_ver
=
$req_nodot
-replace
'(\d)(\d+)'
,
'$1.$2.0'
if
(
$
env
:
PYTHON
-eq
"C:\Python
${req_nodot}
-x64"
)
{
$exe_suffix
=
"-amd64"
}
elseif
(
$
env
:
PYTHON
-eq
"C:\Python
${req_nodot}
"
)
{
$exe_suffix
=
""
}
else
{
exit
0
}
$py_url
=
"https://www.python.org/ftp/python"
Write-Host
"Installing Python
${req_ver}$exe_suffix
..."
-ForegroundColor
Cyan
$exePath
=
"
$
env
:
TEMP
\python-
${req_ver}${exe_suffix}
.exe"
$downloadFile
=
"
$py_url
/
${req_ver}
/python-
${req_ver}${exe_suffix}
.exe"
Write-Host
"Downloading
$downloadFile
..."
(
New-Object
Net.WebClient
)
.
DownloadFile
(
$downloadFile
,
$exePath
)
Write-Host
"Installing..."
cmd
/c
start
/wait
$exePath
/quiet
TargetDir
=
"
$
env
:
PYTHON
"
Shortcuts
=
0
Include_launcher
=
0
InstallLauncherAllUsers
=
0
Write-Host
"Python
${req_ver}
installed to
$
env
:
PYTHON
"
echo
"
$(
&
$py_exe
--version
2
>
$null
)
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment