-
Notifications
You must be signed in to change notification settings - Fork 58
add powershell install script. #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
|
|
||
| $RTT_PYTHON = "python" | ||
|
|
||
| function Test-Command( [string] $CommandName ) { | ||
| (Get-Command $CommandName -ErrorAction SilentlyContinue) -ne $null | ||
| } | ||
|
|
||
| foreach ($p_cmd in ("python3","python")) { | ||
| cmd /c $p_cmd --version | Out-Null | ||
| if (!$?) { continue } | ||
| $RTT_PYTHON = $p_cmd | ||
| break | ||
| } | ||
|
|
||
| if (!(Test-Command $RTT_PYTHON)) { | ||
| echo "Python 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." | ||
| if (Test-Path -Path "D:\") { | ||
| cmd /c Python_setup.exe /quiet TargetDir=D:\Progrem\Python311 InstallAllUsers=1 PrependPath=1 Include_test=0 | ||
| } | ||
| else { | ||
| cmd /c Python_setup.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 | ||
| } | ||
| } | ||
|
|
||
| if (!(Test-Command git)) { | ||
| echo "Git not installed. Will install Git." | ||
| echo "Installing git." | ||
| winget install --id Git.Git -e --source winget | ||
| } | ||
|
|
||
| cmd /c $RTT_PYTHON -m pip list | Out-Null | ||
| if (!$?) { | ||
| echo "Installing pip." | ||
| cmd /c $RTT_PYTHON -m ensurepip --upgrade | ||
| } | ||
|
|
||
| cmd /c $RTT_PYTHON -m pip install --upgrade pip | Out-Null | ||
|
|
||
| if (!(Test-Command scons)) { | ||
| echo "Installing scons." | ||
| cmd /c $RTT_PYTHON -m pip install scons | ||
| } | ||
|
|
||
| cmd /c $RTT_PYTHON -m pip list | findstr "requests" | Out-Null | ||
| if (!$?) { | ||
| echo "Installing requests." | ||
| cmd /c $RTT_PYTHON -m pip install requests | ||
| } | ||
|
|
||
| $url="https://raw.githubusercontent.com/RT-Thread/env/master/touch_env.ps1" | ||
| if ($args[0] -eq "--gitee") { | ||
| $url="https://gitee.com/RT-Thread-Mirror/env/raw/master/touch_env.ps1" | ||
| } | ||
|
|
||
| wget $url -O touch_env.ps1 | ||
| ./touch_env.ps1 $args[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| $DEFAULT_RTT_PACKAGE_URL="https://github.com/RT-Thread/packages.git" | ||
| # you can change the package url by defining RTT_PACKAGE_URL, ex: | ||
| # export RTT_PACKAGE_URL=https://github.com/Varanda-Labs/packages.git | ||
| $RTT_URL="https://github.com/RT-Thread/rt-thread.git" | ||
| $ENV_URL="https://github.com/RT-Thread/env.git" | ||
|
|
||
| if ($args[0] -eq "--gitee") { | ||
| echo "Using gitee service." | ||
| $DEFAULT_RTT_PACKAGE_URL="https://gitee.com/RT-Thread-Mirror/packages.git" | ||
| $RTT_URL="https://gitee.com/rtthread/rt-thread.git" | ||
| $ENV_URL="https://gitee.com/RT-Thread-Mirror/env.git" | ||
| } | ||
|
|
||
| $env_dir = "$HOME\.env" | ||
| if (!(Test-Path -Path $env_dir)) { | ||
| $package_url=$DEFAULT_RTT_PACKAGE_URL | ||
| mkdir $env_dir | Out-Null | ||
| mkdir $env_dir\local_pkgs | Out-Null | ||
| mkdir $env_dir\packages | Out-Null | ||
| mkdir $env_dir\tools | Out-Null | ||
| git clone $package_url $env_dir/packages/packages | ||
| echo 'source "$PKGS_DIR/packages/Kconfig"' > $env_dir/packages/Kconfig | ||
| git clone $ENV_URL $env_dir/tools/scripts | ||
| echo '$env:path="$HOME\.env\tools\scripts;$env:path"' > $env_dir/env.ps1 | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前这个功能不支持