Merge branch 'feature/python2-deprecation-warn_v3.3' into 'release/v3.3'

Tools: Add Python 2 deprecation warning (v3.3)

See merge request espressif/esp-idf!11550
This commit is contained in:
Krzysztof Budzynski 2020-12-11 16:31:18 +08:00
commit 17ca685a15
14 changed files with 156 additions and 20 deletions

View File

@ -276,6 +276,10 @@ def erase_ota_partition(args):
def main():
if sys.version_info[0] < 3:
print("WARNING: Support for Python 2 is deprecated and will be removed in future versions.")
elif sys.version_info[0] == 3 and sys.version_info[1] < 6:
print("WARNING: Python 3 versions older than 3.6 are not supported.")
global quiet
parser = argparse.ArgumentParser("ESP-IDF OTA Partitions Tool")

View File

@ -448,6 +448,10 @@ def create_output_files(name, output_table, debug):
def main():
if sys.version_info[0] < 3:
print("WARNING: Support for Python 2 is deprecated and will be removed in future versions.", file=sys.stderr)
elif sys.version_info[0] == 3 and sys.version_info[1] < 6:
print("WARNING: Python 3 versions older than 3.6 are not supported.", file=sys.stderr)
global quiet
global max_blk_len

View File

@ -5,7 +5,9 @@
# Copyright (c) 2016-2017 Espressif Systems (Shanghai) PTE LTD.
# Distributed under the terms of Apache License v2.0 found in the top-level LICENSE file.
from __future__ import print_function
from optparse import OptionParser
import sys
BASE_ADDR = 0x50000000
@ -26,6 +28,10 @@ def gen_ld_h_from_sym(f_sym, f_ld, f_h):
def main():
if sys.version_info[0] < 3:
print("WARNING: Support for Python 2 is deprecated and will be removed in future versions.", file=sys.stderr)
elif sys.version_info[0] == 3 and sys.version_info[1] < 6:
print("WARNING: Python 3 versions older than 3.6 are not supported.", file=sys.stderr)
description = ("This application generates .h and .ld files for symbols defined in input file. "
"The input symbols file can be generated using nm utility like this: "
"esp32-ulp-nm -g -f posix <elf_file> > <symbols_file>")

View File

@ -14,11 +14,11 @@ To compile with ESP-IDF you need to get the following packages:
- Ubuntu and Debian::
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing libffi-dev libssl-dev
sudo apt-get install git wget libncurses-dev flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev
- Arch::
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing
sudo pacman -Sy --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools cmake ninja ccache dfu-util
.. note::
@ -33,7 +33,7 @@ Compile the Toolchain from Source
- CentOS 7::
sudo yum install gawk gperf grep gettext ncurses-devel python python-devel automake bison flex texinfo help2man libtool
sudo yum install gawk gperf grep gettext ncurses-devel python3 python3-devel automake bison flex texinfo help2man libtool make
- Ubuntu pre-16.04::
@ -49,7 +49,7 @@ Compile the Toolchain from Source
- Arch::
TODO
sudo pacman -Sy --needed python-pip
Create the working directory and go into it::
@ -68,6 +68,11 @@ Build the toolchain::
Toolchain will be built in ``~/esp/crosstool-NG/builds/xtensa-esp32-elf``. Follow :ref:`instructions for standard setup <setup-linux-toolchain-add-it-to-path>` to add the toolchain to your ``PATH``.
Python 2 deprecation
====================
Python 2 reached its `end of life <https://www.python.org/doc/sunset-python-2/>`_ and support for it in ESP-IDF will be removed soon. Please install Python 3.6 or higher. Instructions for popular Linux distributions are listed above.
Next Steps
==========

View File

@ -10,15 +10,17 @@ To compile with ESP-IDF you need to get the following packages:
- CentOS 7::
sudo yum install gcc git wget make ncurses-devel flex bison gperf python python2-cryptography
sudo yum -y update && sudo yum install git wget flex bison gperf python3
CentOS 7 is still supported but CentOS version 8 is recommended for a better user experience.
- Ubuntu and Debian::
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing libffi-dev libssl-dev
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools libffi-dev libssl-dev
- Arch::
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing
sudo pacman -S --needed gcc git make ncurses flex bison gperf
.. note::
@ -84,7 +86,6 @@ Permission issues /dev/ttyUSB0
With some Linux distributions you may get the ``Failed to open port /dev/ttyUSB0`` error message when flashing the ESP32. :ref:`This can be solved by adding the current user to the dialout group<linux-dialout-group>`.
Arch Linux Users
----------------
@ -99,6 +100,46 @@ Before installing these packages you might need to add the author's public key t
Alternatively, use crosstool-NG to compile a gdb that links against ncurses 6.
Setting up Python 3 as default for CentOS
-----------------------------------------
CentOS 7 and older is providing Python 2.7 as the default interpreter.
Python 3 is recommended instead and can be installed in old distributions as follows, or please consult the documentation of your operating system for other recommended ways to achieve this::
sudo yum -y update && sudo yum install python3 python3-pip python3-setuptools
Making Python 3 the default interpreter is possible by running::
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && alias pip=pip3
Setting up Python 3 as default for Ubuntu and Debian
----------------------------------------------------
Ubuntu (version 18.04 and older) and Debian (version 9 and older) are still providing Python 2.7 as the default interpreter.
Python 3 is recommended instead and can be installed in old distributions as follows, or please consult the documentation of your operating system for other recommended ways to achieve this::
sudo apt-get install python3 python3-pip python3-setuptools
Making Python 3 the default interpreter is possible by running::
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && alias pip=pip3
.. note::
This is system-wide change which may affect all of the applications.
Fixing broken pip on Ubuntu 16.04
=================================
Package ``python3-pip`` could be broken without possibility to upgrade it.
Package has to be removed and installed manually using script `get-pip.py <https://bootstrap.pypa.io/get-pip.py>`_.::
apt remove python3-pip python3-virtualenv; rm -r ~/.local
rm -r ~/.espressif/python_env && python get-pip.py
Python 2 deprecation
====================
Python 2 reached its `end of life <https://www.python.org/doc/sunset-python-2/>`_ and support for it in ESP-IDF will be removed soon. Please install Python 3.6 or higher. Instructions for popular Linux distributions are listed above.
Next Steps
==========

View File

@ -65,6 +65,10 @@ Build the toolchain::
Toolchain will be built in ``~/esp/ctng-volume/crosstool-NG/builds/xtensa-esp32-elf``. Follow :ref:`instructions for standard setup <setup-macos-toolchain-add-it-to-path>` to add the toolchain to your ``PATH``.
Python 2 deprecation
====================
Python 2 reached its `end of life <https://www.python.org/doc/sunset-python-2/>`_ and support for it in ESP-IDF will be removed soon. Please install Python 3.6 or higher. Instructions for macOS are listed above.
Next Steps
==========

View File

@ -42,6 +42,11 @@ Alternatively, you may create an alias for the above command. This way you can g
Then when you need the toolchain you can type ``get_esp32`` on the command line and the toolchain will be added to your ``PATH``.
Python 2 deprecation
====================
Python 2 reached its `end of life <https://www.python.org/doc/sunset-python-2/>`_ and support for it in ESP-IDF will be removed soon. Please install Python 3.6 or higher. Instructions for macOS are listed above.
Next Steps
==========

View File

@ -15,13 +15,13 @@
- Ubuntu 和 Debian::
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing libffi-dev libssl-dev
sudo apt-get install git wget libncurses-dev flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev
- Arch::
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing
sudo pacman -Sy --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools cmake ninja ccache
.. note::
.. 注解::
一些旧的2014年之前Linux 发行版中使用的 ``pyserial`` 版本可能是 2.x ESP-IDF并不支持。
在这种情况下,请参考 :ref:`安装依赖的 Python 软件包 <get-started-get-packages>` 章节,通过 ``pip`` 工具来安装支持的版本。
@ -33,7 +33,7 @@
- CentOS 7::
sudo yum install gawk gperf grep gettext ncurses-devel python python-devel automake bison flex texinfo help2man libtool
sudo yum install gawk gperf grep gettext ncurses-devel python3 python3-devel automake bison flex texinfo help2man libtool
- Ubuntu pre-16.04::
@ -49,7 +49,7 @@
- Arch::
TODO
sudo pacman -Sy --needed python-pip
新建工作目录,然后进入::
@ -69,6 +69,10 @@
编译得到的工具链会被保存到 ``~/esp/crosstool-NG/builds/xtensa-esp32-elf``。根据 :ref:`Linux 下设置环境变量的标准方法 <setup-linux-toolchain-add-it-to-path>` 中的介绍,将工具链添加到 ``PATH`` 中。
停用 Python 2
====================
Python 2 已经 `结束生命周期 <https://www.python.org/doc/sunset-python-2/>`_ESP-IDF 很快将不再支持 Python 2。请安装 Python 3.6 或以上版本。可参考上面列出的目前主流 Linux 发行版的安装说明。
下一步
======

View File

@ -12,15 +12,17 @@ Linux 平台工具链的标准设置
- CentOS 7::
sudo yum install gcc git wget make ncurses-devel flex bison gperf python pyserial
sudo yum -y update && sudo yum install git wget flex bison gperf python3
目前仍然支持 CentOS 7但为了更好的用户体验建议使用 CentOS 8。
- Ubuntu and Debian::
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing libffi-dev libssl-dev
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev
- Arch::
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing
sudo pacman -S --needed gcc git make ncurses flex bison gperf
.. note::
@ -98,6 +100,47 @@ Arch Linux 用户
或者,你也可以使用 crosstool-NG 编译一个链接 ncurses 6 的 gdb。
设置 Python 3 为 CentOS 默认 Python 版本
----------------------------------------------------
CentOS 7 及更早的版本提供 Python 2.7 作为默认解释器。但这里推荐使用 Python 3您可以运行下方命令安装 Python 3。或者查看当前所用系统的相关文档按照文档推荐的其它方法安装 Python 3::
sudo yum -y update && sudo yum install python3 python3-pip python3-setuptools
设置 Python 3 为默认 Python 版本::
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && alias pip=pip3
设置 Python 3 为 Ubuntu 和 Debian 默认 Python 版本
----------------------------------------------------
Ubuntuv18.04 及之前的版本)和 Debianv9 及之前的版本)的默认解释器为 Python 2.7,但这里推荐使用 Python 3您可以运行下方命令安装 Python 3。或者查看当前所用系统的相关文档按照文档推荐的其它方法安装 Python 3::
sudo apt-get install python3 python3-pip python3-setuptools
设置 Python 3 为默认 Python 版本::
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && alias pip=pip3
.. 注解::
上述设置为全局设置,同时会影响到其它应用。
修复 Ubuntu 16.04 损坏的 pip
=================================
``python3-pip`` 包可能已损坏无法升级。需使用脚本 `get-pip.py <https://bootstrap.pypa.io/get-pip.py>`_ 手动删除并安装该包::
apt remove python3-pip python3-virtualenv; rm -r ~/.local
rm -r ~/.espressif/python_env && python get-pip.py
停用 Python 2
====================
Python 2 已经 `结束生命周期 <https://www.python.org/doc/sunset-python-2/>`_ESP-IDF 很快将不再支持 Python 2。请安装 Python 3.6 或以上版本。可参考上面列出的目前主流 Linux 发行版的安装说明。
后续步骤
==========

View File

@ -1,5 +1,5 @@
**********************************
从零开始设置 Mac OS 环境下的工具链
从零开始设置 macOS 环境下的工具链
**********************************
:link_to_translation:`en:[English]`
@ -65,6 +65,11 @@
编译得到的工具链会被保存到 ``~/esp/ctng-volume/crosstool-NG/builds/xtensa-esp32-elf``。根据 :ref:`Mac OS 下设置环境变量的标准方法 <setup-macos-toolchain-add-it-to-path>` 中的介绍,将工具链添加到 ``PATH`` 中。
停用 Python 2
====================
Python 2 已经 `结束生命周期 <https://www.python.org/doc/sunset-python-2/>`_ESP-IDF 很快将不再支持 Python 2。请安装 Python 3.6 或以上版本。可参考上面列出的 macOS 安装说明。
下一步
======

View File

@ -44,6 +44,12 @@ Mac OS 版本的 ESP32 工具链可以从以下地址下载:
当需要使用工具链时,在命令行里输入 ``get_esp32``,就可以将工具链添加到 ``PATH`` 中。
停用 Python 2
====================
Python 2 已经 `结束生命周期 <https://www.python.org/doc/sunset-python-2/>`_ESP-IDF 很快将不再支持 Python 2。请安装 Python 3.6 或以上版本。可参考上面列出的 macOS 安装说明。
下一步
==========
@ -57,4 +63,3 @@ Mac OS 版本的 ESP32 工具链可以从以下地址下载:
:maxdepth: 1
macos-setup-scratch

View File

@ -187,6 +187,8 @@ library/error\.o\
\|changes choice state\
\|Compiler version is not supported\
\|Toolchain version is not supported\
\|Python 3 versions older than 3.6 are not supported\
\|Python 2 is deprecated and will be removed in future versions\
"
sort -u "${LOG_SUSPECTED}" | grep -v "${IGNORE_WARNS}" \

View File

@ -174,6 +174,8 @@ library/error\.o\
\|reassigning to symbol\
\|changes choice state\
\|crosstool_version_check\.cmake\
\|Python 3 versions older than 3.6 are not supported\
\|Python 2 is deprecated and will be removed in future versions\
"
sort -u "${LOG_SUSPECTED}" | grep -v "${IGNORE_WARNS}" \

View File

@ -108,6 +108,12 @@ def check_environment():
print("Setting IDF_PATH environment variable: %s" % detected_idf_path)
os.environ["IDF_PATH"] = detected_idf_path
# check Python version
if sys.version_info[0] < 3:
print("WARNING: Support for Python 2 is deprecated and will be removed in future versions.")
elif sys.version_info[0] == 3 and sys.version_info[1] < 6:
print("WARNING: Python 3 versions older than 3.6 are not supported.")
# check Python dependencies
print("Checking Python dependencies...")
try: