mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
tools: correct the coding style of check_python_dependencies.py
This commit is contained in:
parent
98bc172f58
commit
f7281c75c7
1
.flake8
1
.flake8
@ -212,7 +212,6 @@ exclude =
|
|||||||
examples/system/ota/otatool/example_test.py,
|
examples/system/ota/otatool/example_test.py,
|
||||||
examples/wifi/iperf/iperf_test.py,
|
examples/wifi/iperf/iperf_test.py,
|
||||||
examples/wifi/iperf/test_report.py,
|
examples/wifi/iperf/test_report.py,
|
||||||
tools/check_python_dependencies.py,
|
|
||||||
tools/ci/apply_bot_filter.py,
|
tools/ci/apply_bot_filter.py,
|
||||||
tools/cmake/convert_to_cmake.py,
|
tools/cmake/convert_to_cmake.py,
|
||||||
tools/esp_app_trace/apptrace_proc.py,
|
tools/esp_app_trace/apptrace_proc.py,
|
||||||
|
@ -19,12 +19,13 @@ import sys
|
|||||||
import argparse
|
import argparse
|
||||||
try:
|
try:
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
except:
|
except Exception:
|
||||||
print('pkg_resources cannot be imported probably because the pip package is not installed and/or using a '
|
print('pkg_resources cannot be imported probably because the pip package is not installed and/or using a '
|
||||||
'legacy Python interpreter. Please refer to the Get Started section of the ESP-IDF Programming Guide for '
|
'legacy Python interpreter. Please refer to the Get Started section of the ESP-IDF Programming Guide for '
|
||||||
'setting up the required packages.')
|
'setting up the required packages.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def escape_backslash(path):
|
def escape_backslash(path):
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
# escaped backslashes are necessary in order to be able to copy-paste the printed path
|
# escaped backslashes are necessary in order to be able to copy-paste the printed path
|
||||||
@ -32,13 +33,14 @@ def escape_backslash(path):
|
|||||||
else:
|
else:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
idf_path = os.getenv("IDF_PATH")
|
idf_path = os.getenv("IDF_PATH")
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='ESP32 Python package dependency checker')
|
parser = argparse.ArgumentParser(description='ESP32 Python package dependency checker')
|
||||||
parser.add_argument('--requirements', '-r',
|
parser.add_argument('--requirements', '-r',
|
||||||
help='Path to the requrements file',
|
help='Path to the requrements file',
|
||||||
default=os.path.join(idf_path, 'requirements.txt'))
|
default=os.path.join(idf_path, 'requirements.txt'))
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Special case for MINGW32 Python, needs some packages
|
# Special case for MINGW32 Python, needs some packages
|
||||||
@ -48,13 +50,13 @@ if __name__ == "__main__":
|
|||||||
"/mingw32/bin/python" in sys.executable:
|
"/mingw32/bin/python" in sys.executable:
|
||||||
failed = False
|
failed = False
|
||||||
try:
|
try:
|
||||||
import cryptography
|
import cryptography # noqa: intentionally not used - imported for testing its availability
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("Please run the following command to install MSYS2's MINGW Python cryptography package:")
|
print("Please run the following command to install MSYS2's MINGW Python cryptography package:")
|
||||||
print("pacman -Sy mingw-w64-i686-python%d-cryptography" % (sys.version_info[0],))
|
print("pacman -Sy mingw-w64-i686-python%d-cryptography" % (sys.version_info[0],))
|
||||||
failed = True
|
failed = True
|
||||||
try:
|
try:
|
||||||
import setuptools
|
import setuptools # noqa: intentionally not used - imported for testing its availability
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("Please run the following command to install MSYS2's MINGW Python setuptools package:")
|
print("Please run the following command to install MSYS2's MINGW Python setuptools package:")
|
||||||
print("pacman -Sy mingw-w64-i686-python%d-setuptools" % (sys.version_info[0],))
|
print("pacman -Sy mingw-w64-i686-python%d-setuptools" % (sys.version_info[0],))
|
||||||
@ -68,7 +70,7 @@ if __name__ == "__main__":
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
try:
|
try:
|
||||||
pkg_resources.require(line)
|
pkg_resources.require(line)
|
||||||
except:
|
except Exception:
|
||||||
not_satisfied.append(line)
|
not_satisfied.append(line)
|
||||||
|
|
||||||
if len(not_satisfied) > 0:
|
if len(not_satisfied) > 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user