Skip to content

Commit

Permalink
[powershell] add echo message
Browse files Browse the repository at this point in the history
  • Loading branch information
mysterywolf committed Mar 7, 2023
1 parent aa24edd commit 60aa891
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions install_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach ($p_cmd in ("python3", "python", "py")) {

cmd /c $RTT_PYTHON --version | findstr "Python" | Out-Null
if (!$?) {
echo "Python not installed. Will install python 3.11.2."
echo "Python is not installed. Will install python 3.11.2."
echo "Downloading Python."
wget -O Python_setup.exe https://www.python.org/ftp/python/3.11.2/python-3.11.2.exe
echo "Installing Python."
Expand All @@ -26,14 +26,18 @@ if (!$?) {
}
echo "Install Python done. please close the current terminal and run this script again."
exit
} else {
echo "Python environment has installed. Jump this step."
}

$git_url = "https://github.com/git-for-windows/git/releases/download/v2.39.2.windows.1/Git-2.39.2-64-bit.exe"
if ($args[0] -eq "--gitee") {
echo "Use gitee mirror server!"
$git_url = "https://registry.npmmirror.com/-/binary/git-for-windows/v2.39.2.windows.1/Git-2.39.2-64-bit.exe"
}

if (!(Test-Command git)) {
echo "Git not installed. Will install Git."
echo "Git is not installed. Will install Git."
echo "Installing git."
winget install --id Git.Git -e --source winget
if (!$?) {
Expand All @@ -44,6 +48,8 @@ if (!(Test-Command git)) {
cmd /c Git64.exe /quiet PrependPath=1
exit
}
} else {
echo "Git environment has installed. Jump this step."
}

$PIP_SOURCE = "https://pypi.org/simple"
Expand All @@ -57,19 +63,25 @@ cmd /c $RTT_PYTHON -m pip list -i $PIP_SOURCE --trusted-host $PIP_HOST | Out-Nul
if (!$?) {
echo "Installing pip."
cmd /c $RTT_PYTHON -m ensurepip --upgrade
} else {
echo "Pip has installed. Jump this step."
}

cmd /c $RTT_PYTHON -m pip install --upgrade pip -i $PIP_SOURCE --trusted-host $PIP_HOST | Out-Null

if (!(Test-Command scons)) {
echo "Installing scons."
cmd /c $RTT_PYTHON -m pip install scons -i $PIP_SOURCE --trusted-host $PIP_HOST
} else {
echo "Scons has installed. Jump this step."
}

cmd /c $RTT_PYTHON -m pip list -i $PIP_SOURCE --trusted-host $PIP_HOST | findstr "requests" | Out-Null
if (!$?) {
echo "Installing requests."
echo "Installing requests module."
cmd /c $RTT_PYTHON -m pip install requests -i $PIP_SOURCE --trusted-host $PIP_HOST
} else {
echo "requests module has installed. Jump this step."
}

$url="https://raw.githubusercontent.com/RT-Thread/env/master/touch_env.ps1"
Expand All @@ -78,4 +90,5 @@ if ($args[0] -eq "--gitee") {
}

wget $url -O touch_env.ps1
echo "run touch_env.ps1"
./touch_env.ps1 $args[0]

0 comments on commit 60aa891

Please sign in to comment.