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
f538d2a2
Commit
f538d2a2
authored
Oct 16, 2019
by
mattip
Browse files
fix regexp and be more verbose
parent
dc357469
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
install_python.ps1
install_python.ps1
+7
-7
No files found.
install_python.ps1
View file @
f538d2a2
...
...
@@ -5,22 +5,22 @@
$py_exe
=
"
${env:PYTHON}
\Python.exe"
if
(
[
System.IO.File
]::
Exists
(
$py_exe
)
)
{
exit
0
echo
"
$py_exe
exists"
exit
1
}
$req_nodot
=
$
env
:
PYTHON
-replace
'\D+Python(\d+(?:rc\d+))(
?:
-x64)?'
,
'$1'
$req_nodot
=
$
env
:
PYTHON
-replace
'\D+Python(\d+(?:rc\d+)
?
)(-x64)?'
,
'$1'
$req_ver
=
$req_nodot
-replace
'(\d)(\d+)'
,
'$1.$2.0'
$req_dir
=
$req_nodot
-replace
'(\d)(\d+)(.*)'
,
'$1.$2.0'
$last_three
=
$
env
:
PYTHON
[
-3
..
-1
]
-join
''
if
(
$
env
:
PYTHON
-eq
"C:\Python
${req_nodot}
-
x64"
)
{
if
(
$
last_three
-eq
"
x64"
)
{
$exe_suffix
=
"-amd64"
}
elseif
(
$
env
:
PYTHON
-eq
"C:\Python
${req_nodot}
"
)
{
$exe_suffix
=
""
}
else
{
ex
it
0
$
ex
e_suffix
=
""
}
$py_url
=
"https://www.python.org/ftp/python"
Write-Host
"Installing Python
${req_ver}$exe_suffix
..."
-ForegroundColor
Cyan
Write-Host
"Installing Python
${req_dir}
/
${req_ver}$exe_suffix
to
$
env
:
Python
..."
-ForegroundColor
Cyan
$exePath
=
"
$
env
:
TEMP
\python-
${req_ver}${exe_suffix}
.exe"
$downloadFile
=
"
$py_url
/
${req_dir}
/python-
${req_ver}${exe_suffix}
.exe"
...
...
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