Skip to content

Commit

Permalink
[package]use utf-8 open file. (#197)
Browse files Browse the repository at this point in the history
* [package]use utf-8 open file.

* add pkgs.ps1

* [powershell] add pkgs cmd support

* [powershell] support download git.
  • Loading branch information
Guozhanxin authored Mar 6, 2023
1 parent d0d6d12 commit aa24edd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
13 changes: 12 additions & 1 deletion install_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ if (!$?) {
exit
}


$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") {
$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 "Installing git."
winget install --id Git.Git -e --source winget
if (!$?) {
echo "Can't find winget cmd, Will install git 2.39.2."
echo "downloading git."
wget -O Git64.exe $git_url
echo "Please install git. when install done, close the current terminal and run this script again."
cmd /c Git64.exe /quiet PrependPath=1
exit
}
}

$PIP_SOURCE = "https://pypi.org/simple"
Expand Down
4 changes: 2 additions & 2 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@
Return('group')
'''


import codecs
class PackageOperation:
pkg = None

def parse(self, filename):
with open(filename, "r") as f:
with codecs.open(filename, "r", encoding='utf-8') as f:
json_str = f.read()

if json_str:
Expand Down
1 change: 1 addition & 0 deletions pkgs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python $HOME/.env/tools/scripts/env.py package $args
1 change: 1 addition & 0 deletions touch_env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ if (!(Test-Path -Path $env_dir)) {
echo 'source "$PKGS_DIR/packages/Kconfig"' | Out-File -FilePath $env_dir/packages/Kconfig -Encoding ASCII
git clone $ENV_URL $env_dir/tools/scripts
echo '$env:path="$HOME\.env\tools\scripts;$env:path"' > $env_dir/env.ps1
echo '$env:pathext=".PS1;$env:pathext"' >> $env_dir/env.ps1
}

0 comments on commit aa24edd

Please sign in to comment.