From fbd2d804ae137c2f998d0929726965c80ac60457 Mon Sep 17 00:00:00 2001 From: tangzz98 Date: Sun, 4 Dec 2022 15:35:48 -0500 Subject: [PATCH] Only use python3 --- README.md | 4 ++-- install_macos.sh | 6 +++++- install_ubuntu.sh | 20 ++++++-------------- menuconfig | 2 +- pkgs | 2 +- touch_env.sh | 2 +- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 4a8d4e9..4dbcba1 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ ``` wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh chmod 777 install_ubuntu.sh -source ./install_ubuntu.sh +./install_ubuntu.sh ``` 对于中国大陆用户,请使用以下命令 ``` wget https://gitee.com/RT-Thread-Mirror/env/raw/master/install_ubuntu.sh chmod 777 install_ubuntu.sh -source ./install_ubuntu.sh --gitee +./install_ubuntu.sh --gitee ``` ### Prepare Env diff --git a/install_macos.sh b/install_macos.sh index 4db05aa..9e7841d 100755 --- a/install_macos.sh +++ b/install_macos.sh @@ -41,12 +41,16 @@ if ! [ -x "$(command -v scons)" ]; then $RTT_PYTHON -m pip install scons fi +if ! [[ `$RTT_PYTHON -m pip list | grep requests` ]]; then + echo "Installing requests." + $RTT_PYTHON -m pip install requests +fi + if ! [ -x "$(command -v arm-none-eabi-gcc)" ]; then echo "Installing GNU Arm Embedded Toolchain." brew install gnu-arm-embedded fi -export RTT_EXEC_PATH=/usr/bin # set the default tool chain path url=https://raw.githubusercontent.com/RT-Thread/env/master/touch_env.sh if [ $1 ] && [ $1 = --gitee ]; then url=https://gitee.com/RT-Thread-Mirror/env/raw/master/touch_env.sh diff --git a/install_ubuntu.sh b/install_ubuntu.sh index 2962e7e..3e4dcb7 100755 --- a/install_ubuntu.sh +++ b/install_ubuntu.sh @@ -1,29 +1,21 @@ #!/usr/bin/env bash -RTT_PYTHON=python - -for p_cmd in python3 python; do - $p_cmd --version >/dev/null 2>&1 || continue - RTT_PYTHON=$p_cmd - break -done - -$RTT_PYTHON --version 2 > /dev/null || { - echo "Python not installed. Please install Python before running the installation script." +python3 --version 2 > /dev/null || { + echo "Python3 not installed. Please install Python before running the installation script." exit 1 } -$RTT_PYTHON -m pip list > /dev/null || { +python3 -m pip list > /dev/null || { echo "Installing pip." - sudo apt install $RTT_PYTHON-pip -y + sudo apt install python3-pip -y } sudo apt update sudo apt upgrade -y -sudo apt install gcc git libncurses5-dev scons gcc-arm-none-eabi binutils-arm-none-eabi gdb-multiarch qemu qemu-system-arm -y +sudo apt install gcc git libncurses5-dev gcc-arm-none-eabi binutils-arm-none-eabi gdb-multiarch qemu qemu-system-arm -y +python3 -m pip install scons requests -export RTT_EXEC_PATH=/usr/bin # set the default tool chain path url=https://raw.githubusercontent.com/RT-Thread/env/master/touch_env.sh if [ $1 ] && [ $1 = --gitee ]; then url=https://gitee.com/RT-Thread-Mirror/env/raw/master/touch_env.sh diff --git a/menuconfig b/menuconfig index f82be44..8efdf24 100755 --- a/menuconfig +++ b/menuconfig @@ -1 +1 @@ -python ~/.env/tools/scripts/env.py menuconfig $* +python3 ~/.env/tools/scripts/env.py menuconfig $* diff --git a/pkgs b/pkgs index 0ce37df..3cf4ca6 100755 --- a/pkgs +++ b/pkgs @@ -1 +1 @@ -python ~/.env/tools/scripts/env.py package $* +python3 ~/.env/tools/scripts/env.py package $* diff --git a/touch_env.sh b/touch_env.sh index 17333dd..6224a38 100755 --- a/touch_env.sh +++ b/touch_env.sh @@ -23,7 +23,7 @@ if ! [ -d $env_dir ]; then 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 'export PATH=$HOME/.env/tools/scripts:$PATH' > $env_dir/env.sh + echo -e 'export PATH=`python3 -m site --user-base`/bin:$HOME/.env/tools/scripts:$PATH\nexport RTT_EXEC_PATH=/usr/bin' > $env_dir/env.sh fi RTT_ROOT=$HOME/rt-thread