Merge branch 'ci/ruff' into 'master'

Enable ruff for all python files

Closes IDF-9084

See merge request espressif/esp-idf!38044
This commit is contained in:
Peter Dragun
2025-03-31 20:41:37 +08:00
15 changed files with 1006 additions and 1587 deletions

164
.flake8
View File

@ -1,164 +0,0 @@
[flake8]
select =
# Full lists are given in order to suppress all errors from other plugins
# Full list of pyflakes error codes:
F401, # module imported but unused
F402, # import module from line N shadowed by loop variable
F403, # 'from module import *' used; unable to detect undefined names
F404, # future import(s) name after other statements
F405, # name may be undefined, or defined from star imports: module
F406, # 'from module import *' only allowed at module level
F407, # an undefined __future__ feature name was imported
F601, # dictionary key name repeated with different values
F602, # dictionary key variable name repeated with different values
F621, # too many expressions in an assignment with star-unpacking
F622, # two or more starred expressions in an assignment (a, *b, *c = d)
F631, # assertion test is a tuple, which are always True
F701, # a break statement outside of a while or for loop
F702, # a continue statement outside of a while or for loop
F703, # a continue statement in a finally block in a loop
F704, # a yield or yield from statement outside of a function
F705, # a return statement with arguments inside a generator
F706, # a return statement outside of a function/method
F707, # an except: block as not the last exception handler
F721, F722, # doctest syntax error syntax error in forward type annotation
F811, # redefinition of unused name from line N
F812, # list comprehension redefines name from line N
F821, # undefined name name
F822, # undefined name name in __all__
F823, # local variable name referenced before assignment
F831, # duplicate argument name in function definition
F841, # local variable name is assigned to but never used
F901, # raise NotImplemented should be raise NotImplementedError
# Full list of pycodestyle violations:
E101, # indentation contains mixed spaces and tabs
E111, # indentation is not a multiple of four
E112, # expected an indented block
E113, # unexpected indentation
E114, # indentation is not a multiple of four (comment)
E115, # expected an indented block (comment)
E116, # unexpected indentation (comment)
E121, # continuation line under-indented for hanging indent
E122, # continuation line missing indentation or outdented
E123, # closing bracket does not match indentation of opening bracket's line
E124, # closing bracket does not match visual indentation
E125, # continuation line with same indent as next logical line
E126, # continuation line over-indented for hanging indent
E127, # continuation line over-indented for visual indent
E128, # continuation line under-indented for visual indent
E129, # visually indented line with same indent as next logical line
E131, # continuation line unaligned for hanging indent
E133, # closing bracket is missing indentation
E201, # whitespace after '('
E202, # whitespace before ')'
E211, # whitespace before '('
E221, # multiple spaces before operator
E222, # multiple spaces after operator
E223, # tab before operator
E224, # tab after operator
E226, # missing whitespace around arithmetic operator
E227, # missing whitespace around bitwise or shift operator
E228, # missing whitespace around modulo operator
E231, # missing whitespace after ',', ';', or ':'
E241, # multiple spaces after ','
E242, # tab after ','
E251, # unexpected spaces around keyword / parameter equals
E261, # at least two spaces before inline comment
E262, # inline comment should start with '# '
E265, # block comment should start with '# '
E266, # too many leading '#' for block comment
E271, # multiple spaces after keyword
E272, # multiple spaces before keyword
E273, # tab after keyword
E274, # tab before keyword
E275, # missing whitespace after keyword
E301, # expected 1 blank line, found 0
E302, # expected 2 blank lines, found 0
E303, # too many blank lines
E304, # blank lines found after function decorator
E305, # expected 2 blank lines after end of function or class
E306, # expected 1 blank line before a nested definition
E401, # multiple imports on one line
E402, # module level import not at top of file
E501, # line too long (82 > 79 characters)
E502, # the backslash is redundant between brackets
E701, # multiple statements on one line (colon)
E702, # multiple statements on one line (semicolon)
E703, # statement ends with a semicolon
E704, # multiple statements on one line (def)
E711, # comparison to None should be 'if cond is None:'
E712, # comparison to True should be 'if cond is True:' or 'if cond:'
E713, # test for membership should be 'not in'
E714, # test for object identity should be 'is not'
E721, # do not compare types, use 'isinstance()'
E722, # do not use bare except, specify exception instead
E731, # do not assign a lambda expression, use a def
E741, # do not use variables named 'l', 'O', or 'I'
E742, # do not define classes named 'l', 'O', or 'I'
E743, # do not define functions named 'l', 'O', or 'I'
E901, # SyntaxError or IndentationError
E902, # IOError
W191, # indentation contains tabs
W291, # trailing whitespace
W292, # no newline at end of file
W293, # blank line contains whitespace
W391, # blank line at end of file
W503, # line break before binary operator
W504, # line break after binary operator
W505, # doc line too long (82 > 79 characters)
W601, # .has_key() is deprecated, use 'in'
W602, # deprecated form of raising exception
W603, # '<>' is deprecated, use '!='
W604, # backticks are deprecated, use 'repr()'
W605, # invalid escape sequence 'x'
W606, # 'async' and 'await' are reserved keywords starting with Python 3.7
# Full list of flake8 violations
E999, # failed to compile a file into an Abstract Syntax Tree for the plugins that require it
# Full list of mccabe violations
C901 # complexity value provided by the user
ignore =
E221, # multiple spaces before operator
E225, # missing whitespace around operator
E231, # missing whitespace after ',', ';', or ':'
E241, # multiple spaces after ','
W503, # line break before binary operator
W504 # line break after binary operator
max-line-length = 160
show_source = True
statistics = True
exclude =
.git,
__pycache__,
# submodules
components/bootloader/subproject/components/micro-ecc/micro-ecc,
components/bt/host/nimble/nimble,
components/cmock/CMock,
components/json/cJSON,
components/mbedtls/mbedtls,
components/openthread/openthread,
components/unity/unity,
components/spiffs/spiffs,
# autogenerated scripts
components/protocomm/python/constants_pb2.py,
components/protocomm/python/sec0_pb2.py,
components/protocomm/python/sec1_pb2.py,
components/protocomm/python/sec2_pb2.py,
components/protocomm/python/session_pb2.py,
components/wifi_provisioning/python/wifi_ctrl_pb2.py,
components/wifi_provisioning/python/wifi_scan_pb2.py,
components/wifi_provisioning/python/wifi_config_pb2.py,
components/wifi_provisioning/python/wifi_constants_pb2.py,
components/esp_local_ctrl/python/esp_local_ctrl_pb2.py,
per-file-ignores =
# Sphinx conf.py files use star imports to setup config variables
docs/conf_common.py: F405

View File

@ -66,6 +66,7 @@
/export.* @esp-idf-codeowners/tools
/install.* @esp-idf-codeowners/tools
/pytest.ini @esp-idf-codeowners/ci
/ruff.toml @esp-idf-codeowners/tools
/sdkconfig.rename @esp-idf-codeowners/build-config
/sonar-project.properties @esp-idf-codeowners/ci

View File

@ -145,11 +145,11 @@ check if there's a suitable `.if-<if-anchor-you-need>` anchor
1. if there is, create a rule following [`rules` Template Naming Rules](#rules-template-naming-rules).For detail information, please refer to [GitLab Documentation `rules-if`](https://docs.gitlab.com/ee/ci/yaml/README.html#rulesif). Here's an example.
```yaml
.rules:patterns:python-files:
.rules:patterns:clang_tidy:
rules:
- <<: *if-protected
- <<: *if-dev-push
changes: *patterns-python-files
changes: *patterns-c-files
```
2. if there isn't

View File

@ -270,11 +270,6 @@
- <<: *if-dev-push
changes: *patterns-c-files
.rules:patterns:python-files:
rules:
- <<: *if-protected
- <<: *if-dev-push
changes: *patterns-python-files
#.rules:patterns:static-code-analysis-preview:
# rules:

View File

@ -16,28 +16,6 @@ clang_tidy_check:
--limit-file tools/ci/static-analysis-rules.yml
--xtensa-include-dir
check_pylint:
extends:
- .pre_check_template
- .rules:patterns:python-files
needs:
- pipeline_variables
artifacts:
reports:
codequality: pylint.json
paths:
- pylint.json
expire_in: 1 week
when: always
script:
- |
if [ -n "$CI_MERGE_REQUEST_IID" ]; then
export files=$(echo "$GIT_DIFF_OUTPUT" | grep ".py$" | xargs);
else
export files=$(git ls-files "*.py" | xargs);
fi
- if [ -z "$files" ]; then echo "No python files found"; exit 0; fi
- run_cmd pylint --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate:pylint.json $files
#
## build stage
## Sonarqube related jobs put here for this reason:

View File

@ -8,8 +8,8 @@ repos:
rev: "v0.9.7"
hooks:
- id: ruff-format
args: [ "--preview" ]
files: 'pytest_.*\.py$'
- id: ruff
args: [ "--fix" ]
- repo: local
hooks:
- id: pytest-linter
@ -65,23 +65,6 @@ repos:
- id: no-commit-to-branch
name: Do not use uppercase letters in the branch name
args: ['--pattern', '^[^A-Z]*[A-Z]']
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: ['--config=.flake8', '--tee', '--benchmark']
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
name: Reorder Python imports
args: [--py38-plus]
exclude: >
(?x)^(
.*_pb2.py
)$
|pytest_eth_iperf.py
|pytest_iperf.py
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:

641
.pylintrc
View File

@ -1,641 +0,0 @@
[MAIN]
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Clear in-memory caches upon conclusion of linting. Useful if running pylint
# in a server-like mode.
clear-cache-post-run=no
# Load and enable all available extensions. Use --list-extensions to see a list
# all available extensions.
#enable-all-extensions=
# In error mode, messages with a category besides ERROR or FATAL are
# suppressed, and no reports are done by default. Error mode is compatible with
# disabling specific errors.
#errors-only=
# Always return a 0 (non-error) status code, even if lint errors are found.
# This is primarily useful in continuous integration scripts.
#exit-zero=
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-allow-list=
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
# for backward compatibility.)
extension-pkg-whitelist=
# Return non-zero exit code if any of these messages/categories are detected,
# even if score is above --fail-under value. Syntax same as enable. Messages
# specified are enabled, while categories only check already-enabled messages.
fail-on=
# Specify a score threshold under which the program will exit with error.
fail-under=10
# Interpret the stdin as a python script, whose filename needs to be passed as
# the module_or_package argument.
#from-stdin=
# Files or directories to be skipped. They should be base names, not paths.
ignore=CVS
# Add files or directories matching the regular expressions patterns to the
# ignore-list. The regex matches against paths and can be in Posix or Windows
# format. Because '\\' represents the directory delimiter on Windows systems,
# it can't be used as an escape character.
ignore-paths=
# Files or directories matching the regular expression patterns are skipped.
# The regex matches against base names, not paths. The default value ignores
# Emacs file locks
ignore-patterns=^\.#
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
jobs=1
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
limit-inference-results=100
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.8
# Discover python modules and packages in the file system subtree.
recursive=no
# Add paths to the list of the source roots. Supports globbing patterns. The
# source root is an absolute path or a path relative to the current working
# directory used to determine a package namespace for modules located under the
# source root.
source-roots=
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
# In verbose mode, extra non-checker-related info will be displayed.
#verbose=
[BASIC]
# Naming style matching correct argument names.
argument-naming-style=snake_case
# Regular expression matching correct argument names. Overrides argument-
# naming-style. If left empty, argument names will be checked with the set
# naming style.
#argument-rgx=
# Naming style matching correct attribute names.
attr-naming-style=snake_case
# Regular expression matching correct attribute names. Overrides attr-naming-
# style. If left empty, attribute names will be checked with the set naming
# style.
#attr-rgx=
# Bad variable names which should always be refused, separated by a comma.
bad-names=foo,
bar,
baz,
toto,
tutu,
tata
# Bad variable names regexes, separated by a comma. If names match any regex,
# they will always be refused
bad-names-rgxs=
# Naming style matching correct class attribute names.
class-attribute-naming-style=any
# Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style. If left empty, class attribute names will be checked
# with the set naming style.
#class-attribute-rgx=
# Naming style matching correct class constant names.
class-const-naming-style=UPPER_CASE
# Regular expression matching correct class constant names. Overrides class-
# const-naming-style. If left empty, class constant names will be checked with
# the set naming style.
#class-const-rgx=
# Naming style matching correct class names.
class-naming-style=PascalCase
# Regular expression matching correct class names. Overrides class-naming-
# style. If left empty, class names will be checked with the set naming style.
#class-rgx=
# Naming style matching correct constant names.
const-naming-style=UPPER_CASE
# Regular expression matching correct constant names. Overrides const-naming-
# style. If left empty, constant names will be checked with the set naming
# style.
#const-rgx=
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming style matching correct function names.
function-naming-style=snake_case
# Regular expression matching correct function names. Overrides function-
# naming-style. If left empty, function names will be checked with the set
# naming style.
#function-rgx=
# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
ex,
Run,
_
# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
good-names-rgxs=
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
# Naming style matching correct inline iteration names.
inlinevar-naming-style=any
# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style. If left empty, inline iteration names will be checked
# with the set naming style.
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=snake_case
# Regular expression matching correct method names. Overrides method-naming-
# style. If left empty, method names will be checked with the set naming style.
#method-rgx=
# Naming style matching correct module names.
module-naming-style=snake_case
# Regular expression matching correct module names. Overrides module-naming-
# style. If left empty, module names will be checked with the set naming style.
#module-rgx=
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty
# Regular expression matching correct type alias names. If left empty, type
# alias names will be checked with the set naming style.
#typealias-rgx=
# Regular expression matching correct type variable names. If left empty, type
# variable names will be checked with the set naming style.
#typevar-rgx=
# Naming style matching correct variable names.
variable-naming-style=snake_case
# Regular expression matching correct variable names. Overrides variable-
# naming-style. If left empty, variable names will be checked with the set
# naming style.
#variable-rgx=
[CLASSES]
# Warn about protected attribute access inside special methods
check-protected-access-in-special-methods=no
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
setUp,
asyncSetUp,
__post_init__
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs
[DESIGN]
# List of regular expressions of class ancestor names to ignore when counting
# public methods (see R0903)
exclude-too-few-public-methods=
# List of qualified class names to ignore when counting class parents (see
# R0901)
ignored-parents=
# Maximum number of arguments for function / method.
max-args=5
# Maximum number of attributes for a class (see R0902).
max-attributes=7
# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5
# Maximum number of branch for function / method body.
max-branches=12
# Maximum number of locals for function / method body.
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body.
max-returns=6
# Maximum number of statements in function / method body.
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
[EXCEPTIONS]
# Exceptions that will emit a warning when caught.
overgeneral-exceptions=builtins.BaseException,builtins.Exception
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=160
# Maximum number of lines in a module.
max-module-lines=1000
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[IMPORTS]
# List of modules that can be imported at any level, not just the top level
# one.
allow-any-import-level=
# Allow explicit reexports by alias from a package __init__.
allow-reexport-from-package=no
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Deprecated modules which should not be used, separated by a comma.
deprecated-modules=
# Output a graph (.gv or any supported image format) of external dependencies
# to the given file (report RP0402 must not be disabled).
ext-import-graph=
# Output a graph (.gv or any supported image format) of all (i.e. internal and
# external) dependencies to the given file (report RP0402 must not be
# disabled).
import-graph=
# Output a graph (.gv or any supported image format) of internal dependencies
# to the given file (report RP0402 must not be disabled).
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
# Couples of modules and preferred modules, separated by a comma.
preferred-modules=
[LOGGING]
# The type of string formatting that logging methods do. `old` means using %
# formatting, `new` is for `{}` formatting.
logging-format-style=old
# Logging modules to check that the string format arguments are in logging
# function parameter format.
logging-modules=logging
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
# UNDEFINED.
confidence=HIGH,
CONTROL_FLOW,
INFERENCE,
INFERENCE_FAILURE,
UNDEFINED
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
missing-function-docstring, # Modified since here, include this line
missing-class-docstring,
missing-module-docstring,
wrong-import-order,
invalid-name,
too-few-public-methods,
too-many-locals,
ungrouped-imports, # since we have isort in pre-commit
no-name-in-module, # since we have flake8 to check this
too-many-instance-attributes,
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
[METHOD_ARGS]
# List of qualified names (i.e., library.method) which require a timeout
# parameter e.g. 'requests.api.get,requests.api.post'
timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,
XXX,
TODO
# Regular expression of note tags to take in consideration.
notes-rgx=
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
# it will be considered as an explicit return statement and no message will be
# printed.
never-returning-functions=sys.exit,argparse.parse_error
[REPORTS]
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
# 'convention', and 'info' which contain the number of messages in each
# category, as well as 'statement' which is the total number of statements
# analyzed. This score is used by the global evaluation report (RP0004).
evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details.
msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
#output-format=
# Tells whether to display a full report or only the messages.
reports=no
# Activate the evaluation score.
score=yes
[SIMILARITIES]
# Comments are removed from the similarity computation
ignore-comments=yes
# Docstrings are removed from the similarity computation
ignore-docstrings=yes
# Imports are removed from the similarity computation
ignore-imports=yes
# Signatures are removed from the similarity computation
ignore-signatures=yes
# Minimum lines number of a similarity.
min-similarity-lines=4
[SPELLING]
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4
# Spelling dictionary name. No available dictionaries : You need to install
# both the python package and the system dependency for enchant to work..
spelling-dict=
# List of comma separated words that should be considered directives if they
# appear at the beginning of a comment and should not be checked.
spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains the private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to the private dictionary (see the
# --spelling-private-dict-file option) instead of raising a message.
spelling-store-unknown-words=no
[STRING]
# This flag controls whether inconsistent-quotes generates a warning when the
# character used as a quote delimiter is used inconsistently within a module.
check-quote-consistency=no
# This flag controls whether the implicit-str-concat should generate a warning
# on implicit string concatenation in sequences defined over several lines.
check-str-concat-over-line-jumps=no
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
ignore-none=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of symbolic message names to ignore for Mixin members.
ignored-checks-for-mixins=no-member,
not-async-context-manager,
not-context-manager,
attribute-defined-outside-init
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
# Regex pattern to define which classes are considered mixins.
mixin-class-rgx=.*[Mm]ixin
# List of decorators that change the signature of a decorated function.
signature-mutators=
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid defining new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of names allowed to shadow builtins
allowed-redefined-builtins=
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored.
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io

View File

@ -16,77 +16,84 @@ from esp_docs.conf_docs import * # noqa: F403,F401
if os.environ.get('IDF_PATH') is None:
raise RuntimeError('IDF_PATH should be set, run export.sh before building docs')
BT_DOCS = ['api-reference/bluetooth/esp_bt_defs.rst',
'api-reference/bluetooth/esp_bt_device.rst',
'api-reference/bluetooth/esp_bt_main.rst',
'api-reference/bluetooth/bt_common.rst',
'api-reference/bluetooth/bt_vhci.rst',
'api-reference/bluetooth/controller_vhci.rst',
'api-reference/bluetooth/index.rst']
BT_DOCS = [
'api-reference/bluetooth/esp_bt_defs.rst',
'api-reference/bluetooth/esp_bt_device.rst',
'api-reference/bluetooth/esp_bt_main.rst',
'api-reference/bluetooth/bt_common.rst',
'api-reference/bluetooth/bt_vhci.rst',
'api-reference/bluetooth/controller_vhci.rst',
'api-reference/bluetooth/index.rst',
]
BLE_DOCS = ['api-guides/ble/index.rst',
'api-guides/ble/overview.rst',
'api-guides/ble/ble-feature-support-status.rst',
'api-guides/ble/host-feature-support-status.rst',
'api-guides/ble/ble-qualification.rst',
'api-guides/ble/get-started/ble-introduction.rst',
'api-guides/ble/get-started/ble-device-discovery.rst',
'api-guides/ble/get-started/ble-connection.rst',
'api-guides/ble/get-started/ble-data-exchange.rst',
'api-reference/bluetooth/bt_le.rst',
'api-reference/bluetooth/esp_gap_ble.rst',
'api-reference/bluetooth/esp_gatt_defs.rst',
'api-reference/bluetooth/esp_gatts.rst',
'api-reference/bluetooth/esp_gattc.rst',
'api-reference/bluetooth/nimble/index.rst',
'migration-guides/release-5.x/5.0/bluetooth-low-energy.rst']
BLE_DOCS = [
'api-guides/ble/index.rst',
'api-guides/ble/overview.rst',
'api-guides/ble/ble-feature-support-status.rst',
'api-guides/ble/host-feature-support-status.rst',
'api-guides/ble/ble-qualification.rst',
'api-guides/ble/get-started/ble-introduction.rst',
'api-guides/ble/get-started/ble-device-discovery.rst',
'api-guides/ble/get-started/ble-connection.rst',
'api-guides/ble/get-started/ble-data-exchange.rst',
'api-reference/bluetooth/bt_le.rst',
'api-reference/bluetooth/esp_gap_ble.rst',
'api-reference/bluetooth/esp_gatt_defs.rst',
'api-reference/bluetooth/esp_gatts.rst',
'api-reference/bluetooth/esp_gattc.rst',
'api-reference/bluetooth/nimble/index.rst',
'migration-guides/release-5.x/5.0/bluetooth-low-energy.rst',
]
BLE_MESH_DOCS = ['api-guides/esp-ble-mesh/ble-mesh-index.rst',
'api-guides/esp-ble-mesh/ble-mesh-feature-list.rst',
'api-guides/esp-ble-mesh/ble-mesh-terminology.rst',
'api-guides/esp-ble-mesh/ble-mesh-architecture.rst',
'api-guides/esp-ble-mesh/ble-mesh-faq.rst',
'api-reference/bluetooth/esp-ble-mesh.rst']
BLE_MESH_DOCS = [
'api-guides/esp-ble-mesh/ble-mesh-index.rst',
'api-guides/esp-ble-mesh/ble-mesh-feature-list.rst',
'api-guides/esp-ble-mesh/ble-mesh-terminology.rst',
'api-guides/esp-ble-mesh/ble-mesh-architecture.rst',
'api-guides/esp-ble-mesh/ble-mesh-faq.rst',
'api-reference/bluetooth/esp-ble-mesh.rst',
]
CLASSIC_BT_DOCS = ['api-guides/classic-bt/index.rst',
'api-guides/classic-bt/overview.rst',
'api-reference/bluetooth/classic_bt.rst',
'api-reference/bluetooth/esp_a2dp.rst',
'api-reference/bluetooth/esp_avrc.rst',
'api-reference/bluetooth/esp_hidd.rst',
'api-reference/bluetooth/esp_hidh.rst',
'api-reference/bluetooth/esp_l2cap_bt.rst',
'api-reference/bluetooth/esp_sdp.rst',
'api-reference/bluetooth/esp_hf_defs.rst',
'api-reference/bluetooth/esp_hf_client.rst',
'api-reference/bluetooth/esp_hf_ag.rst',
'api-reference/bluetooth/esp_spp.rst',
'api-reference/bluetooth/esp_gap_bt.rst',
'migration-guides/release-5.x/5.0/bluetooth-classic.rst']
CLASSIC_BT_DOCS = [
'api-guides/classic-bt/index.rst',
'api-guides/classic-bt/overview.rst',
'api-reference/bluetooth/classic_bt.rst',
'api-reference/bluetooth/esp_a2dp.rst',
'api-reference/bluetooth/esp_avrc.rst',
'api-reference/bluetooth/esp_hidd.rst',
'api-reference/bluetooth/esp_hidh.rst',
'api-reference/bluetooth/esp_l2cap_bt.rst',
'api-reference/bluetooth/esp_sdp.rst',
'api-reference/bluetooth/esp_hf_defs.rst',
'api-reference/bluetooth/esp_hf_client.rst',
'api-reference/bluetooth/esp_hf_ag.rst',
'api-reference/bluetooth/esp_spp.rst',
'api-reference/bluetooth/esp_gap_bt.rst',
'migration-guides/release-5.x/5.0/bluetooth-classic.rst',
]
BLUFI_DOCS = ['api-guides/ble/blufi.rst',
'api-reference/bluetooth/esp_blufi.rst']
BLUFI_DOCS = ['api-guides/ble/blufi.rst', 'api-reference/bluetooth/esp_blufi.rst']
WIFI_DOCS = ['api-guides/low-power-mode/low-power-mode-wifi.rst',
'api-guides/wifi.rst',
'api-guides/wifi-security.rst',
'api-guides/wireshark-user-guide.rst',
'api-reference/network/esp_now.rst',
'api-reference/network/esp_smartconfig.rst',
'api-reference/network/esp_wifi.rst',
'api-reference/network/esp_dpp.rst',
'api-reference/provisioning/provisioning.rst',
'api-reference/provisioning/wifi_provisioning.rst',
'migration-guides/release-5.x/5.2/wifi.rst']
WIFI_DOCS = [
'api-guides/low-power-mode/low-power-mode-wifi.rst',
'api-guides/wifi.rst',
'api-guides/wifi-security.rst',
'api-guides/wireshark-user-guide.rst',
'api-reference/network/esp_now.rst',
'api-reference/network/esp_smartconfig.rst',
'api-reference/network/esp_wifi.rst',
'api-reference/network/esp_dpp.rst',
'api-reference/provisioning/provisioning.rst',
'api-reference/provisioning/wifi_provisioning.rst',
'migration-guides/release-5.x/5.2/wifi.rst',
]
IEEE802154_DOCS = ['migration-guides/release-5.x/5.1/ieee802154.rst',
'migration-guides/release-5.x/5.2/ieee802154.rst']
IEEE802154_DOCS = ['migration-guides/release-5.x/5.1/ieee802154.rst', 'migration-guides/release-5.x/5.2/ieee802154.rst']
NAN_DOCS = ['api-reference/network/esp_nan.rst']
WIFI_MESH_DOCS = ['api-guides/esp-wifi-mesh.rst',
'api-reference/network/esp-wifi-mesh.rst']
WIFI_MESH_DOCS = ['api-guides/esp-wifi-mesh.rst', 'api-reference/network/esp-wifi-mesh.rst']
COEXISTENCE_DOCS = ['api-guides/coexist.rst']
@ -102,8 +109,7 @@ UART_DOCS = ['api-reference/peripherals/uart.rst']
SDMMC_DOCS = ['api-reference/peripherals/sdmmc_host.rst']
SDIO_SLAVE_DOCS = ['api-reference/peripherals/sdio_slave.rst',
'api-reference/protocols/esp_sdio_slave_protocol.rst']
SDIO_SLAVE_DOCS = ['api-reference/peripherals/sdio_slave.rst', 'api-reference/protocols/esp_sdio_slave_protocol.rst']
MCPWM_DOCS = ['api-reference/peripherals/mcpwm.rst']
@ -127,16 +133,18 @@ TOUCH_SENSOR_DOCS = ['api-reference/peripherals/cap_touch_sens.rst']
SPIRAM_DOCS = ['api-guides/external-ram.rst']
USB_DOCS = ['api-reference/peripherals/usb_device.rst',
'api-reference/peripherals/usb_host.rst',
'api-reference/peripherals/usb_host/usb_host_notes_arch.rst',
'api-reference/peripherals/usb_host/usb_host_notes_design.rst',
'api-reference/peripherals/usb_host/usb_host_notes_dwc_otg.rst',
'api-reference/peripherals/usb_host/usb_host_notes_index.rst',
'api-reference/peripherals/usb_host/usb_host_notes_usbh.rst',
'api-reference/peripherals/usb_host/usb_host_notes_enum.rst',
'api-reference/peripherals/usb_host/usb_host_notes_ext_hub.rst',
'api-reference/peripherals/usb_host/usb_host_notes_ext_port.rst']
USB_DOCS = [
'api-reference/peripherals/usb_device.rst',
'api-reference/peripherals/usb_host.rst',
'api-reference/peripherals/usb_host/usb_host_notes_arch.rst',
'api-reference/peripherals/usb_host/usb_host_notes_design.rst',
'api-reference/peripherals/usb_host/usb_host_notes_dwc_otg.rst',
'api-reference/peripherals/usb_host/usb_host_notes_index.rst',
'api-reference/peripherals/usb_host/usb_host_notes_usbh.rst',
'api-reference/peripherals/usb_host/usb_host_notes_enum.rst',
'api-reference/peripherals/usb_host/usb_host_notes_ext_hub.rst',
'api-reference/peripherals/usb_host/usb_host_notes_ext_port.rst',
]
I80_LCD_DOCS = ['api-reference/peripherals/lcd/i80_lcd.rst']
RGB_LCD_DOCS = ['api-reference/peripherals/lcd/rgb_lcd.rst']
@ -149,19 +157,24 @@ USB_OTG_CONSOLE_DOCS = ['api-guides/usb-otg-console.rst']
FTDI_JTAG_DOCS = ['api-guides/jtag-debugging/configure-ft2232h-jtag.rst']
USB_SERIAL_JTAG_DOCS = ['api-guides/jtag-debugging/configure-builtin-jtag.rst',
'api-guides/usb-serial-jtag-console.rst']
USB_SERIAL_JTAG_DOCS = [
'api-guides/jtag-debugging/configure-builtin-jtag.rst',
'api-guides/usb-serial-jtag-console.rst',
]
ULP_FSM_DOCS = ['api-reference/system/ulp.rst',
'api-reference/system/ulp_macros.rst',
'api-reference/system/ulp_instruction_set.rst']
ULP_FSM_DOCS = [
'api-reference/system/ulp.rst',
'api-reference/system/ulp_macros.rst',
'api-reference/system/ulp_instruction_set.rst',
]
RISCV_COPROC_DOCS = ['api-reference/system/ulp-risc-v.rst',]
RISCV_COPROC_DOCS = [
'api-reference/system/ulp-risc-v.rst',
]
LP_CORE_DOCS = ['api-reference/system/ulp-lp-core.rst']
XTENSA_DOCS = ['api-guides/hlinterrupts.rst',
'api-reference/system/perfmon.rst']
XTENSA_DOCS = ['api-guides/hlinterrupts.rst', 'api-reference/system/perfmon.rst']
RISCV_DOCS = [] # type: list[str]
@ -169,15 +182,19 @@ TWAI_DOCS = ['api-reference/peripherals/twai.rst']
SDM_DOCS = ['api-reference/peripherals/sdm.rst']
I2C_DOCS = ['api-reference/peripherals/i2c.rst',
'api-reference/peripherals/lcd/i2c_lcd.rst',
'api-reference/peripherals/i2c_slave_v1.rst']
I2C_DOCS = [
'api-reference/peripherals/i2c.rst',
'api-reference/peripherals/lcd/i2c_lcd.rst',
'api-reference/peripherals/i2c_slave_v1.rst',
]
SPI_DOCS = ['api-reference/peripherals/spi_master.rst',
'api-reference/peripherals/spi_slave.rst',
'api-reference/peripherals/sdspi_host.rst',
'api-reference/peripherals/sdspi_share.rst',
'api-reference/peripherals/lcd/spi_lcd.rst']
SPI_DOCS = [
'api-reference/peripherals/spi_master.rst',
'api-reference/peripherals/spi_slave.rst',
'api-reference/peripherals/sdspi_host.rst',
'api-reference/peripherals/sdspi_share.rst',
'api-reference/peripherals/lcd/spi_lcd.rst',
]
I2S_DOCS = ['api-reference/peripherals/i2s.rst']
@ -189,8 +206,7 @@ ISP_DOCS = ['api-reference/peripherals/isp.rst']
DSLP_STUB_DOCS = ['api-guides/deep-sleep-stub.rst']
ADC_DOCS = ['api-reference/peripherals/adc_oneshot.rst',
'api-reference/peripherals/adc_calibration.rst']
ADC_DOCS = ['api-reference/peripherals/adc_oneshot.rst', 'api-reference/peripherals/adc_calibration.rst']
ADC_DMA_DOCS = ['api-reference/peripherals/adc_continuous.rst']
ANA_CMPR_DOCS = ['api-reference/peripherals/ana_cmpr.rst']
@ -203,148 +219,173 @@ PPA_DOCS = ['api-reference/peripherals/ppa.rst']
QEMU_DOCS = ['api-guides/tools/qemu.rst']
ESP_TEE_DOCS = ['security/tee/index.rst',
'security/tee/tee.rst',
'security/tee/tee-advanced.rst',
'security/tee/tee-attestation.rst',
'security/tee/tee-ota.rst',
'security/tee/tee-sec-storage.rst']
ESP_TEE_DOCS = [
'security/tee/index.rst',
'security/tee/tee.rst',
'security/tee/tee-advanced.rst',
'security/tee/tee-attestation.rst',
'security/tee/tee-ota.rst',
'security/tee/tee-sec-storage.rst',
]
ESP32_DOCS = ['api-reference/system/himem.rst',
'api-guides/romconsole.rst',
'api-reference/system/ipc.rst',
'security/secure-boot-v1.rst',
'api-reference/peripherals/dac.rst',
'api-reference/peripherals/sd_pullup_requirements.rst',
'hw-reference/esp32/**',
'api-guides/RF_calibration.rst',
'api-guides/phy.rst'] + FTDI_JTAG_DOCS + QEMU_DOCS
ESP32_DOCS = (
[
'api-reference/system/himem.rst',
'api-guides/romconsole.rst',
'api-reference/system/ipc.rst',
'security/secure-boot-v1.rst',
'api-reference/peripherals/dac.rst',
'api-reference/peripherals/sd_pullup_requirements.rst',
'hw-reference/esp32/**',
'api-guides/RF_calibration.rst',
'api-guides/phy.rst',
]
+ FTDI_JTAG_DOCS
+ QEMU_DOCS
)
ESP32S2_DOCS = ['hw-reference/esp32s2/**',
'api-guides/usb-console.rst',
'api-reference/peripherals/ds.rst',
'api-reference/peripherals/temp_sensor.rst',
'api-reference/system/async_memcpy.rst',
'api-reference/peripherals/touch_element.rst',
'api-guides/RF_calibration.rst',
'api-guides/phy.rst'] + FTDI_JTAG_DOCS + USB_OTG_DFU_DOCS + USB_OTG_CONSOLE_DOCS
ESP32S2_DOCS = (
[
'hw-reference/esp32s2/**',
'api-guides/usb-console.rst',
'api-reference/peripherals/ds.rst',
'api-reference/peripherals/temp_sensor.rst',
'api-reference/system/async_memcpy.rst',
'api-reference/peripherals/touch_element.rst',
'api-guides/RF_calibration.rst',
'api-guides/phy.rst',
]
+ FTDI_JTAG_DOCS
+ USB_OTG_DFU_DOCS
+ USB_OTG_CONSOLE_DOCS
)
ESP32S3_DOCS = ['hw-reference/esp32s3/**',
'api-reference/system/ipc.rst',
'api-guides/flash_psram_config.rst',
'api-reference/peripherals/sd_pullup_requirements.rst',
'api-guides/RF_calibration.rst',
'api-guides/phy.rst'] + USB_OTG_DFU_DOCS + USB_OTG_CONSOLE_DOCS + QEMU_DOCS
ESP32S3_DOCS = (
[
'hw-reference/esp32s3/**',
'api-reference/system/ipc.rst',
'api-guides/flash_psram_config.rst',
'api-reference/peripherals/sd_pullup_requirements.rst',
'api-guides/RF_calibration.rst',
'api-guides/phy.rst',
]
+ USB_OTG_DFU_DOCS
+ USB_OTG_CONSOLE_DOCS
+ QEMU_DOCS
)
# No JTAG docs for this one as it gets gated on SOC_USB_SERIAL_JTAG_SUPPORTED down below.
ESP32C3_DOCS = ['hw-reference/esp32c3/**',
'api-guides/RF_calibration.rst',
'api-guides/phy.rst'] + QEMU_DOCS
ESP32C3_DOCS = ['hw-reference/esp32c3/**', 'api-guides/RF_calibration.rst', 'api-guides/phy.rst'] + QEMU_DOCS
ESP32C2_DOCS = ['api-guides/RF_calibration.rst',
'api-guides/phy.rst']
ESP32C2_DOCS = ['api-guides/RF_calibration.rst', 'api-guides/phy.rst']
ESP32C5_DOCS = ['api-guides/phy.rst']
ESP32C61_DOCS = ['api-guides/phy.rst']
ESP32C6_DOCS = ['api-guides/RF_calibration.rst',
'api-reference/peripherals/sd_pullup_requirements.rst',
'api-guides/phy.rst'] + ESP_TEE_DOCS
ESP32C6_DOCS = [
'api-guides/RF_calibration.rst',
'api-reference/peripherals/sd_pullup_requirements.rst',
'api-guides/phy.rst',
] + ESP_TEE_DOCS
ESP32H2_DOCS = ['api-guides/RF_calibration.rst',
'api-guides/phy.rst']
ESP32H2_DOCS = ['api-guides/RF_calibration.rst', 'api-guides/phy.rst']
ESP32P4_DOCS = ['api-reference/system/ipc.rst',
'api-reference/peripherals/cap_touch_sens.rst',
'api-reference/peripherals/sd_pullup_requirements.rst'] + USB_OTG_DFU_DOCS
ESP32P4_DOCS = [
'api-reference/system/ipc.rst',
'api-reference/peripherals/cap_touch_sens.rst',
'api-reference/peripherals/sd_pullup_requirements.rst',
] + USB_OTG_DFU_DOCS
# format: {tag needed to include: documents to included}, tags are parsed from sdkconfig and peripheral_caps.h headers
conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS,
'SOC_BLE_SUPPORTED':BLE_DOCS,
'SOC_BLE_MESH_SUPPORTED':BLE_MESH_DOCS,
'SOC_BLUFI_SUPPORTED':BLUFI_DOCS,
'SOC_WIFI_SUPPORTED':WIFI_DOCS,
'SOC_BT_CLASSIC_SUPPORTED':CLASSIC_BT_DOCS,
'SOC_IEEE802154_SUPPORTED':IEEE802154_DOCS,
'SOC_SUPPORT_COEXISTENCE':COEXISTENCE_DOCS,
'SOC_PSRAM_DMA_CAPABLE':MM_SYNC_DOCS,
'SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE':MM_SYNC_DOCS,
'SOC_CLK_TREE_SUPPORTED':CLK_TREE_DOCS,
'SOC_UART_SUPPORTED':UART_DOCS,
'SOC_SDMMC_HOST_SUPPORTED':SDMMC_DOCS,
'SOC_SDIO_SLAVE_SUPPORTED':SDIO_SLAVE_DOCS,
'SOC_MCPWM_SUPPORTED':MCPWM_DOCS,
'SOC_USB_OTG_SUPPORTED':USB_DOCS,
'SOC_USB_SERIAL_JTAG_SUPPORTED':USB_SERIAL_JTAG_DOCS,
'SOC_DEDICATED_GPIO_SUPPORTED':DEDIC_GPIO_DOCS,
'SOC_LCD_I80_SUPPORTED':I80_LCD_DOCS,
'SOC_LCD_RGB_SUPPORTED':RGB_LCD_DOCS,
'SOC_PARLIO_SUPPORT_SPI_LCD':PARLIO_LCD_DOCS,
'SOC_MIPI_DSI_SUPPORTED':DSI_LCD_DOCS,
'SOC_SPIRAM_SUPPORTED':SPIRAM_DOCS,
'SOC_PARLIO_SUPPORTED':PARLIO_DOCS,
'SOC_PCNT_SUPPORTED':PCNT_DOCS,
'SOC_RMT_SUPPORTED':RMT_DOCS,
'SOC_DAC_SUPPORTED':DAC_DOCS,
'SOC_ETM_SUPPORTED':ETM_DOCS,
'SOC_ULP_FSM_SUPPORTED':ULP_FSM_DOCS,
'SOC_RISCV_COPROC_SUPPORTED':RISCV_COPROC_DOCS,
'SOC_LP_CORE_SUPPORTED':LP_CORE_DOCS,
'SOC_DIG_SIGN_SUPPORTED':['api-reference/peripherals/ds.rst'],
'SOC_ECDSA_SUPPORTED':['api-reference/peripherals/ecdsa.rst'],
'SOC_HMAC_SUPPORTED':['api-reference/peripherals/hmac.rst'],
'SOC_ASYNC_MEMCPY_SUPPORTED':['api-reference/system/async_memcpy.rst'],
'CONFIG_IDF_TARGET_ARCH_XTENSA':XTENSA_DOCS,
'CONFIG_IDF_TARGET_ARCH_RISCV':RISCV_DOCS,
'SOC_TEMP_SENSOR_SUPPORTED':TEMP_SENSOR_DOCS,
'SOC_TOUCH_SENSOR_SUPPORTED':TOUCH_SENSOR_DOCS,
'SOC_TWAI_SUPPORTED':TWAI_DOCS,
'SOC_I2C_SUPPORTED':I2C_DOCS,
'SOC_GPSPI_SUPPORTED':SPI_DOCS,
'SOC_I2S_SUPPORTED':I2S_DOCS,
'SOC_LP_I2S_SUPPORTED':LP_I2S_DOCS,
'SOC_LP_VAD_SUPPORTED':VAD_DOCS,
'SOC_ISP_SUPPORTED':ISP_DOCS,
'ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB': DSLP_STUB_DOCS,
'SOC_ADC_SUPPORTED':ADC_DOCS,
'SOC_ADC_DMA_SUPPORTED':ADC_DMA_DOCS,
'SOC_ANA_CMPR_SUPPORTED': ANA_CMPR_DOCS,
'SOC_SDM_SUPPORTED':SDM_DOCS,
'SOC_WIFI_MESH_SUPPORT':WIFI_MESH_DOCS,
'SOC_MIPI_CSI_SUPPORTED':CAMERA_DOCS,
'SOC_BITSCRAMBLER_SUPPORTED':BITSCRAMBLER_DOCS,
'SOC_SPI_SUPPORT_SLAVE_HD_VER2':SPI_SLAVE_HD_DOCS,
'SOC_WIFI_NAN_SUPPORT':NAN_DOCS,
'SOC_JPEG_CODEC_SUPPORTED':JPEG_DOCS,
'SOC_PPA_SUPPORTED':PPA_DOCS,
'SOC_GP_LDO_SUPPORTED':LDO_DOCS,
'esp32':ESP32_DOCS,
'esp32s2':ESP32S2_DOCS,
'esp32s3':ESP32S3_DOCS,
'esp32c2':ESP32C2_DOCS,
'esp32c3':ESP32C3_DOCS,
'esp32c5':ESP32C5_DOCS,
'esp32c6':ESP32C6_DOCS,
'esp32c61':ESP32C61_DOCS,
'esp32h2':ESP32H2_DOCS,
'esp32p4':ESP32P4_DOCS}
conditional_include_dict = {
'SOC_BT_SUPPORTED': BT_DOCS,
'SOC_BLE_SUPPORTED': BLE_DOCS,
'SOC_BLE_MESH_SUPPORTED': BLE_MESH_DOCS,
'SOC_BLUFI_SUPPORTED': BLUFI_DOCS,
'SOC_WIFI_SUPPORTED': WIFI_DOCS,
'SOC_BT_CLASSIC_SUPPORTED': CLASSIC_BT_DOCS,
'SOC_IEEE802154_SUPPORTED': IEEE802154_DOCS,
'SOC_SUPPORT_COEXISTENCE': COEXISTENCE_DOCS,
'SOC_PSRAM_DMA_CAPABLE': MM_SYNC_DOCS,
'SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE': MM_SYNC_DOCS,
'SOC_CLK_TREE_SUPPORTED': CLK_TREE_DOCS,
'SOC_UART_SUPPORTED': UART_DOCS,
'SOC_SDMMC_HOST_SUPPORTED': SDMMC_DOCS,
'SOC_SDIO_SLAVE_SUPPORTED': SDIO_SLAVE_DOCS,
'SOC_MCPWM_SUPPORTED': MCPWM_DOCS,
'SOC_USB_OTG_SUPPORTED': USB_DOCS,
'SOC_USB_SERIAL_JTAG_SUPPORTED': USB_SERIAL_JTAG_DOCS,
'SOC_DEDICATED_GPIO_SUPPORTED': DEDIC_GPIO_DOCS,
'SOC_LCD_I80_SUPPORTED': I80_LCD_DOCS,
'SOC_LCD_RGB_SUPPORTED': RGB_LCD_DOCS,
'SOC_PARLIO_SUPPORT_SPI_LCD': PARLIO_LCD_DOCS,
'SOC_MIPI_DSI_SUPPORTED': DSI_LCD_DOCS,
'SOC_SPIRAM_SUPPORTED': SPIRAM_DOCS,
'SOC_PARLIO_SUPPORTED': PARLIO_DOCS,
'SOC_PCNT_SUPPORTED': PCNT_DOCS,
'SOC_RMT_SUPPORTED': RMT_DOCS,
'SOC_DAC_SUPPORTED': DAC_DOCS,
'SOC_ETM_SUPPORTED': ETM_DOCS,
'SOC_ULP_FSM_SUPPORTED': ULP_FSM_DOCS,
'SOC_RISCV_COPROC_SUPPORTED': RISCV_COPROC_DOCS,
'SOC_LP_CORE_SUPPORTED': LP_CORE_DOCS,
'SOC_DIG_SIGN_SUPPORTED': ['api-reference/peripherals/ds.rst'],
'SOC_ECDSA_SUPPORTED': ['api-reference/peripherals/ecdsa.rst'],
'SOC_HMAC_SUPPORTED': ['api-reference/peripherals/hmac.rst'],
'SOC_ASYNC_MEMCPY_SUPPORTED': ['api-reference/system/async_memcpy.rst'],
'CONFIG_IDF_TARGET_ARCH_XTENSA': XTENSA_DOCS,
'CONFIG_IDF_TARGET_ARCH_RISCV': RISCV_DOCS,
'SOC_TEMP_SENSOR_SUPPORTED': TEMP_SENSOR_DOCS,
'SOC_TOUCH_SENSOR_SUPPORTED': TOUCH_SENSOR_DOCS,
'SOC_TWAI_SUPPORTED': TWAI_DOCS,
'SOC_I2C_SUPPORTED': I2C_DOCS,
'SOC_GPSPI_SUPPORTED': SPI_DOCS,
'SOC_I2S_SUPPORTED': I2S_DOCS,
'SOC_LP_I2S_SUPPORTED': LP_I2S_DOCS,
'SOC_LP_VAD_SUPPORTED': VAD_DOCS,
'SOC_ISP_SUPPORTED': ISP_DOCS,
'ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB': DSLP_STUB_DOCS,
'SOC_ADC_SUPPORTED': ADC_DOCS,
'SOC_ADC_DMA_SUPPORTED': ADC_DMA_DOCS,
'SOC_ANA_CMPR_SUPPORTED': ANA_CMPR_DOCS,
'SOC_SDM_SUPPORTED': SDM_DOCS,
'SOC_WIFI_MESH_SUPPORT': WIFI_MESH_DOCS,
'SOC_MIPI_CSI_SUPPORTED': CAMERA_DOCS,
'SOC_BITSCRAMBLER_SUPPORTED': BITSCRAMBLER_DOCS,
'SOC_SPI_SUPPORT_SLAVE_HD_VER2': SPI_SLAVE_HD_DOCS,
'SOC_WIFI_NAN_SUPPORT': NAN_DOCS,
'SOC_JPEG_CODEC_SUPPORTED': JPEG_DOCS,
'SOC_PPA_SUPPORTED': PPA_DOCS,
'SOC_GP_LDO_SUPPORTED': LDO_DOCS,
'esp32': ESP32_DOCS,
'esp32s2': ESP32S2_DOCS,
'esp32s3': ESP32S3_DOCS,
'esp32c2': ESP32C2_DOCS,
'esp32c3': ESP32C3_DOCS,
'esp32c5': ESP32C5_DOCS,
'esp32c6': ESP32C6_DOCS,
'esp32c61': ESP32C61_DOCS,
'esp32h2': ESP32H2_DOCS,
'esp32p4': ESP32P4_DOCS,
}
extensions += ['sphinx_copybutton',
'sphinxcontrib.wavedrom',
# Note: order is important here, events must
# be registered by one extension before they can be
# connected to another extension
'esp_docs.idf_extensions.build_system',
'esp_docs.idf_extensions.esp_err_definitions',
'esp_docs.idf_extensions.gen_defines',
'esp_docs.idf_extensions.gen_version_specific_includes',
'esp_docs.idf_extensions.kconfig_reference',
'esp_docs.idf_extensions.gen_idf_tools_links',
'esp_docs.esp_extensions.run_doxygen',
'esp_docs.esp_extensions.add_html_zip',
'linuxdoc.rstFlatTable', # https://return42.github.io/linuxdoc/linuxdoc-howto/table-markup.html#flat-table
]
extensions += [ # noqa: F405
'sphinx_copybutton',
'sphinxcontrib.wavedrom',
# Note: order is important here, events must
# be registered by one extension before they can be
# connected to another extension
'esp_docs.idf_extensions.build_system',
'esp_docs.idf_extensions.esp_err_definitions',
'esp_docs.idf_extensions.gen_defines',
'esp_docs.idf_extensions.gen_version_specific_includes',
'esp_docs.idf_extensions.kconfig_reference',
'esp_docs.idf_extensions.gen_idf_tools_links',
'esp_docs.esp_extensions.run_doxygen',
'esp_docs.esp_extensions.add_html_zip',
'linuxdoc.rstFlatTable', # https://return42.github.io/linuxdoc/linuxdoc-howto/table-markup.html#flat-table
]
# Use wavedrompy as backend, instead of wavedrom-cli
render_using_wavedrompy = True
@ -355,8 +396,8 @@ smartquotes = False
github_repo = 'espressif/esp-idf'
# context used by sphinx_idf_theme
html_context['github_user'] = 'espressif'
html_context['github_repo'] = 'esp-idf'
html_context['github_user'] = 'espressif' # noqa: F405
html_context['github_repo'] = 'esp-idf' # noqa: F405
# Extra options required by sphinx_idf_theme
@ -372,26 +413,33 @@ project_homepage = 'https://github.com/espressif/esp-idf'
linkcheck_anchors = False
linkcheck_exclude_documents = ['index', # several false positives due to the way we link to different sections
'api-reference/protocols/esp_local_ctrl', # Fails due to `https://<mdns-hostname>.local`
'api-reference/provisioning/wifi_provisioning', # Fails due to `https://<mdns-hostname>.local`
]
linkcheck_exclude_documents = [
'index', # several false positives due to the way we link to different sections
'api-reference/protocols/esp_local_ctrl', # Fails due to `https://<mdns-hostname>.local`
'api-reference/provisioning/wifi_provisioning', # Fails due to `https://<mdns-hostname>.local`
]
linkcheck_ignore = ['https://webhome.phy.duke.edu/~rgb/General/dieharder.php', # Certificate error
'https://docs.espressif.com/projects/esptool/en/latest/esp32c2/espefuse/index.html', # Not published
'https://docs.espressif.com/projects/esptool/en/latest/esp32c2/espsecure/index.html#remote-signing-using-an-external-hs', # Not published
'https://docs.espressif.com/projects/esptool/en/latest/esp32c6/espefuse/index.html', # Not published
'https://docs.espressif.com/projects/esptool/en/latest/esp32c6/espsecure/index.html#remote-signing-using-an-external-hs', # Not published
'https://docs.espressif.com/projects/esptool/en/latest/esp32h2/espefuse/index.html', # Not published
'https://docs.espressif.com/projects/esptool/en/latest/esp32h2/espsecure/index.html#remote-signing-using-an-external-hs', # Not published
'https://www.cadence.com/content/dam/cadence-www/global/en_US/documents/tools/ip/tensilica-ip/isa-summary.pdf', # Rejects user-agent
]
# URLs to ignore during linkcheck
linkcheck_ignore = [
# Certificate error
'https://webhome.phy.duke.edu/~rgb/General/dieharder.php',
# Not published docs
'https://docs.espressif.com/projects/esptool/en/latest/esp32c2/espefuse/index.html',
'https://docs.espressif.com/projects/esptool/en/latest/esp32c2/espsecure/index.html#remote-signing-using-an-external-hs',
'https://docs.espressif.com/projects/esptool/en/latest/esp32c6/espefuse/index.html',
'https://docs.espressif.com/projects/esptool/en/latest/esp32c6/espsecure/index.html#remote-signing-using-an-external-hs',
'https://docs.espressif.com/projects/esptool/en/latest/esp32h2/espefuse/index.html',
'https://docs.espressif.com/projects/esptool/en/latest/esp32h2/espsecure/index.html#remote-signing-using-an-external-hs',
# Rejects user-agent
'https://www.cadence.com/content/dam/cadence-www/global/en_US/documents/tools/ip/tensilica-ip/isa-summary.pdf',
]
# Custom added feature to allow redirecting old URLs
with open('../page_redirects.txt') as f:
lines = [re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')]
lines = [
re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')
]
for line in lines: # check for well-formed entries
if len(line.split(' ')) != 2:
raise RuntimeError('Invalid line in page_redirects.txt: %s' % line)
@ -399,7 +447,10 @@ html_redirect_pages = [tuple(line.split(' ')) for line in lines]
html_static_path = ['../_static']
idf_build_system = {'doxygen_component_info': True, 'component_info_ignore_file': Path(os.environ['IDF_PATH']) / 'docs' / 'component_info_ignore_file.txt'}
idf_build_system = {
'doxygen_component_info': True,
'component_info_ignore_file': Path(os.environ['IDF_PATH']) / 'docs' / 'component_info_ignore_file.txt',
}
# Please update following list to enable Qemu doc guide (and cross references) for a new target
QEMU_TARGETS = ['esp32', 'esp32c3', 'esp32s3']
@ -408,7 +459,9 @@ QEMU_TARGETS = ['esp32', 'esp32c3', 'esp32s3']
# Callback function for user setup that needs be done after `config-init`-event
# config.idf_target is not available at the initial config stage
def conf_setup(app, config):
config.add_warnings_content = 'This document is not updated for {} yet, so some of the content may not be correct.'.format(config.idf_target.upper())
config.add_warnings_content = (
f'This document is not updated for {config.idf_target.upper()} yet, so some of the content may not be correct.'
)
add_warnings_file = '{}/../docs_not_updated/{}.txt'.format(app.confdir, config.idf_target)

View File

@ -2,6 +2,50 @@ line-length = 120
target-version = "py38"
[format]
quote-style = "single"
exclude = []
docstring-code-format = true
quote-style = "single"
docstring-code-format = true
[lint]
select = [
"A", # flake8-builtins
"E", # pycodestyle
"F", # pyflakes
"W", # pycodestyle
"I", # reorder-imports
]
ignore = [
"E203", # whitespace before ':'
"E221", # multiple spaces before operator
"E225", # missing whitespace around operator
"E231", # missing whitespace after ',', ';', or ':'
"E241", # multiple spaces after ','
]
# Exclude a variety of commonly ignored directories.
exclude = [
".git",
"__pycache__",
# submodules
"components/bootloader/subproject/components/micro-ecc/micro-ecc",
"components/bt/host/nimble/nimble",
"components/cmock/CMock",
"components/JSON/cJSON",
"components/mbedtls/mbedtls",
"components/openthread/openthread",
"components/unity/unity",
"components/spiffs/spiffs",
# autogenerated scripts
"components/protocomm/python/constants_pb2.py",
"components/protocomm/python/sec0_pb2.py",
"components/protocomm/python/sec1_pb2.py",
"components/protocomm/python/sec2_pb2.py",
"components/protocomm/python/session_pb2.py",
"components/wifi_provisioning/python/wifi_ctrl_pb2.py",
"components/wifi_provisioning/python/wifi_scan_pb2.py",
"components/wifi_provisioning/python/wifi_config_pb2.py",
"components/wifi_provisioning/python/wifi_constants_pb2.py",
"components/esp_local_ctrl/python/esp_local_ctrl_pb2.py",
]
[lint.isort]
force-single-line = true

View File

@ -12,20 +12,23 @@ try:
from packaging.requirements import Requirement
from packaging.version import Version
except ImportError:
print('packaging cannot be imported. '
'If you\'ve installed a custom Python then this package is provided separately and have to be installed as well. '
'Please refer to the Get Started section of the ESP-IDF Programming Guide for setting up the required packages.')
print(
'packaging cannot be imported. '
"If you've installed a custom Python then this package is provided separately and have to be installed as "
'well. Please refer to the Get Started section of the ESP-IDF Programming Guide for setting up the required '
'packages.'
)
sys.exit(1)
try:
from importlib.metadata import PackageNotFoundError
from importlib.metadata import requires as _requires
from importlib.metadata import version as _version
from importlib.metadata import PackageNotFoundError
except ImportError:
# compatibility for python <=3.7
from importlib_metadata import PackageNotFoundError # type: ignore
from importlib_metadata import requires as _requires # type: ignore
from importlib_metadata import version as _version # type: ignore
from importlib_metadata import PackageNotFoundError # type: ignore
try:
from typing import Set
@ -66,12 +69,20 @@ def get_requires(name: str) -> Optional[list]:
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='ESP-IDF Python package dependency checker')
parser.add_argument('--requirements', '-r',
help='Path to a requirements file (can be used multiple times)',
action='append', default=[])
parser.add_argument('--constraints', '-c', default=[],
help='Path to a constraints file (can be used multiple times)',
action='append')
parser.add_argument(
'--requirements',
'-r',
help='Path to a requirements file (can be used multiple times)',
action='append',
default=[],
)
parser.add_argument(
'--constraints',
'-c',
default=[],
help='Path to a constraints file (can be used multiple times)',
action='append',
)
args = parser.parse_args()
required_set = set()
@ -87,7 +98,8 @@ if __name__ == '__main__':
con = os.path.basename(con)
elif con.startswith('--only-binary'):
continue
elif con.startswith('-e') and '#egg=' in con: # version control URLs, take the egg= part at the end only
# version control URLs, take the egg= part at the end only
elif con.startswith('-e') and '#egg=' in con:
con_m = re.search(r'#egg=([^\s]+)', con)
if not con_m:
print('Malformed input. Cannot find name in {}'.format(con))
@ -103,7 +115,7 @@ if __name__ == '__main__':
not_satisfied = [] # in string form which will be printed
# already_checked set is used in order to avoid circular checks which would cause looping.
already_checked = set() # type: Set[Requirement]
already_checked: Set[Requirement] = set()
# required_set contains package names in string form without version constraints. If the package has a constraint
# specification (package name + version requirement) then use that instead. new_req_list is used to store
@ -125,7 +137,10 @@ if __name__ == '__main__':
except Exception as e:
# Catch general exception, because get_version may return None (https://github.com/python/cpython/issues/91216)
# log package name alongside the error message for easier debugging
not_satisfied.append(f"Error while checking requirement '{req}'. Package was not found and is required by the application: {e}")
not_satisfied.append(
f"Error while checking requirement '{req}'. Package was not found and is required by the "
f'application: {e}'
)
new_req_list.remove(req)
else:
new_req_list.remove(req)
@ -138,7 +153,7 @@ if __name__ == '__main__':
try:
dependency_requirements = set()
extras = list(requirement.extras) or ['']
# `requires` returns all sub-requirements including all extras - we need to filter out just required ones
# `requires` returns all sub-requirements including all extras; we need to filter out just required ones
for name in get_requires(requirement.name) or []:
sub_req = Requirement(name)
# check extras e.g. esptool[hsm]
@ -155,7 +170,10 @@ if __name__ == '__main__':
except Exception as e:
# Catch general exception, because get_version may return None (https://github.com/python/cpython/issues/91216)
# log package name alongside the error message for easier debugging
not_satisfied.append(f"Error while checking requirement '{req}'. Package was not found and is required by the application: {e}")
not_satisfied.append(
f"Error while checking requirement '{req}'. Package was not found and is required by the "
f'application: {e}'
)
if len(not_satisfied) > 0:
print('The following Python requirements are not satisfied:')
@ -166,8 +184,10 @@ if __name__ == '__main__':
install_script = 'install.bat' if sys.platform == 'win32' else 'install.sh'
print('To install the missing packages, please run "{}"'.format(install_script))
else:
print('Please follow the instructions found in the "Set up the tools" section of '
'ESP-IDF Getting Started Guide.')
print(
'Please follow the instructions found in the "Set up the tools" section of '
'ESP-IDF Getting Started Guide.'
)
print('Diagnostic information:')
idf_python_env_path = os.environ.get('IDF_PYTHON_ENV_PATH')

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
#
# This program creates archives compatible with ESP32-S* ROM DFU implementation.
@ -19,13 +19,13 @@ from collections import namedtuple
from functools import partial
try:
import typing
import typing # noqa: F401
except ImportError:
# Only used for type annotations
pass
try:
from itertools import izip as zip # type: ignore
from itertools import izip as zip # type: ignore # noqa: A004
except ImportError:
# Python 3
pass
@ -55,10 +55,8 @@ CPIOHeader = namedtuple(
CPIO_TRAILER = 'TRAILER!!!'
def make_cpio_header(
filename_len, file_len, is_trailer=False
): # type: (int, int, bool) -> CPIOHeader
""" Returns CPIOHeader for the given file name and file size """
def make_cpio_header(filename_len, file_len, is_trailer=False): # type: (int, int, bool) -> CPIOHeader
"""Returns CPIOHeader for the given file name and file size"""
def as_hex(val): # type: (int) -> bytes
return '{:08x}'.format(val).encode('ascii')
@ -91,9 +89,7 @@ DFUInfo = namedtuple('DFUInfo', ['address', 'flags', 'name', 'md5'])
DFUINFO_FILE = 'dfuinfo0.dat'
# Structure which gets added at the end of the entire DFU file
DFUSUFFIX_STRUCT = b'<H H H H 3s B'
DFUSuffix = namedtuple(
'DFUSuffix', ['bcd_device', 'pid', 'vid', 'bcd_dfu', 'sig', 'len']
)
DFUSuffix = namedtuple('DFUSuffix', ['bcd_device', 'pid', 'vid', 'bcd_dfu', 'sig', 'len'])
ESPRESSIF_VID = 12346
# This CRC32 gets added after DFUSUFFIX_STRUCT
DFUCRC_STRUCT = b'<I'
@ -114,19 +110,19 @@ FlashParamsData = namedtuple(
)
FLASH_PARAMS_STRUCT = b'<IIIIIIII'
FLASH_PARAMS_FILE = 'flash_params.dat'
DFU_INFO_FLAG_PARAM = (1 << 2)
DFU_INFO_FLAG_NOERASE = (1 << 3)
DFU_INFO_FLAG_IGNORE_MD5 = (1 << 4)
DFU_INFO_FLAG_PARAM = 1 << 2
DFU_INFO_FLAG_NOERASE = 1 << 3
DFU_INFO_FLAG_IGNORE_MD5 = 1 << 4
def dfu_crc(data, crc=0): # type: (bytes, int) -> int
""" Calculate CRC32/JAMCRC of data, with an optional initial value """
"""Calculate CRC32/JAMCRC of data, with an optional initial value"""
uint32_max = 0xFFFFFFFF
return uint32_max - (zlib.crc32(data, crc) & uint32_max)
def pad_bytes(b, multiple, padding=b'\x00'): # type: (bytes, int, bytes) -> bytes
""" Pad 'b' to a length divisible by 'multiple' """
"""Pad 'b' to a length divisible by 'multiple'"""
padded_len = (len(b) + multiple - 1) // multiple * multiple
return b + padding * (padded_len - len(b))
@ -150,7 +146,7 @@ class EspDfuWriter(object):
self.entries = [] # type: typing.List[bytes]
self.index = [] # type: typing.List[DFUInfo]
def add_flash_params_file(self, flash_size): # type: (str) -> None
def add_flash_params_file(self, flash_size): # type: (str) -> None
"""
Add a file containing flash chip parameters
@ -167,7 +163,7 @@ class EspDfuWriter(object):
block_size=64 * 1024,
sector_size=4 * 1024,
page_size=256,
status_mask=0xffff,
status_mask=0xFFFF,
)
data = struct.pack(FLASH_PARAMS_STRUCT, *flash_params)
flags = DFU_INFO_FLAG_PARAM | DFU_INFO_FLAG_NOERASE | DFU_INFO_FLAG_IGNORE_MD5
@ -193,7 +189,7 @@ class EspDfuWriter(object):
flash_addr += len(chunk)
def finish(self): # type: () -> None
""" Write DFU file """
"""Write DFU file"""
# Prepare and add dfuinfo0.dat file
dfuinfo = b''.join([struct.pack(DFUINFO_STRUCT, *item) for item in self.index])
self._add_cpio_entry(DFUINFO_FILE, dfuinfo, first=True)
@ -214,9 +210,7 @@ class EspDfuWriter(object):
# Finally write the entire binary
self.dest.write(out_data)
def _add_cpio_flash_entry(
self, filename, flash_addr, data, flags=0
): # type: (str, int, bytes, int) -> None
def _add_cpio_flash_entry(self, filename, flash_addr, data, flags=0): # type: (str, int, bytes, int) -> None
md5 = hashlib.md5()
md5.update(data)
self.index.append(
@ -229,14 +223,10 @@ class EspDfuWriter(object):
)
self._add_cpio_entry(filename, data)
def _add_cpio_entry(
self, filename, data, first=False, trailer=False
): # type: (str, bytes, bool, bool) -> None
def _add_cpio_entry(self, filename, data, first=False, trailer=False): # type: (str, bytes, bool, bool) -> None
filename_b = filename.encode('utf-8') + b'\x00'
cpio_header = make_cpio_header(len(filename_b), len(data), is_trailer=trailer)
entry = pad_bytes(
struct.pack(CPIO_STRUCT, *cpio_header) + filename_b, 4
) + pad_bytes(data, 4)
entry = pad_bytes(struct.pack(CPIO_STRUCT, *cpio_header) + filename_b, 4) + pad_bytes(data, 4)
if not first:
self.entries.append(entry)
else:
@ -262,27 +252,33 @@ def main(): # type: () -> None
# Provision to add "info" command
subparsers = parser.add_subparsers(dest='command')
write_parser = subparsers.add_parser('write')
write_parser.add_argument('-o', '--output-file',
help='Filename for storing the output DFU image',
required=True,
type=argparse.FileType('wb'))
write_parser.add_argument('--pid',
required=True,
type=lambda h: int(h, 16),
help='Hexa-decimal product indentificator')
write_parser.add_argument('--json',
help='Optional file for loading "flash_files" dictionary with <address> <file> items')
write_parser.add_argument('--part-size',
default=os.environ.get('ESP_DFU_PART_SIZE', 512 * 1024),
type=lambda x: int(x, 0),
help='Larger files are split-up into smaller partitions of this size')
write_parser.add_argument('files',
metavar='<address> <file>', help='Add <file> at <address>',
nargs='*')
write_parser.add_argument('-fs', '--flash-size',
help='SPI Flash size in MegaBytes (1MB, 2MB, 4MB, 8MB, 16MB, 32MB, 64MB, 128MB)',
choices=['1MB', '2MB', '4MB', '8MB', '16MB', '32MB', '64MB', '128MB'],
default='2MB')
write_parser.add_argument(
'-o',
'--output-file',
help='Filename for storing the output DFU image',
required=True,
type=argparse.FileType('wb'),
)
write_parser.add_argument(
'--pid', required=True, type=lambda h: int(h, 16), help='Hexa-decimal product indentificator'
)
write_parser.add_argument(
'--json', help='Optional file for loading "flash_files" dictionary with <address> <file> items'
)
write_parser.add_argument(
'--part-size',
default=os.environ.get('ESP_DFU_PART_SIZE', 512 * 1024),
type=lambda x: int(x, 0),
help='Larger files are split-up into smaller partitions of this size',
)
write_parser.add_argument('files', metavar='<address> <file>', help='Add <file> at <address>', nargs='*')
write_parser.add_argument(
'-fs',
'--flash-size',
help='SPI Flash size in MegaBytes (1MB, 2MB, 4MB, 8MB, 16MB, 32MB, 64MB, 128MB)',
choices=['1MB', '2MB', '4MB', '8MB', '16MB', '32MB', '64MB', '128MB'],
default='2MB',
)
args = parser.parse_args()
@ -299,28 +295,28 @@ def main(): # type: () -> None
json_dir = os.path.dirname(os.path.abspath(args.json))
def process_json_file(path): # type: (str) -> str
'''
"""
The input path is relative to json_dir. This function makes it relative to the current working
directory.
'''
"""
return check_file(os.path.relpath(os.path.join(json_dir, path), start=os.curdir))
with open(args.json, encoding='utf-8') as f:
files += [(int(addr, 0),
process_json_file(f_name)) for addr, f_name in json.load(f)['flash_files'].items()]
files += [(int(addr, 0), process_json_file(f_name)) for addr, f_name in json.load(f)['flash_files'].items()]
files = sorted([(addr, f_name) for addr, f_name in dict(files).items()],
key=lambda x: x[0]) # remove possible duplicates and sort based on the address
files = sorted(
[(addr, f_name) for addr, f_name in dict(files).items()], key=lambda x: x[0]
) # remove possible duplicates and sort based on the address
cmd_args = {'output_file': args.output_file,
'files': files,
'pid': args.pid,
'part_size': args.part_size,
'flash_size': args.flash_size,
}
cmd_args = {
'output_file': args.output_file,
'files': files,
'pid': args.pid,
'part_size': args.part_size,
'flash_size': args.flash_size,
}
{'write': action_write
}[args.command](cmd_args)
{'write': action_write}[args.command](cmd_args)
if __name__ == '__main__':

View File

@ -13,6 +13,5 @@ junit_xml
python-gitlab
pyyaml
SimpleWebSocketServer
pylint-gitlab
minio
prettytable

View File

@ -56,7 +56,8 @@ def test_something(test_app_copy):
# the current working directory now contains the copy of the test app
```
If the test case doesn't use the `test_app_copy` argument, pylint will typically warn about an unused argument, even if the fixture is actually used. To avoid the warning, use the following pattern:
If the test case doesn't use the `test_app_copy` argument, ruff will typically warn about an unused argument, even if the fixture is actually used. To avoid the warning, use the following pattern:
```python
@pytest.mark.usefixtures('test_app_copy')
def test_something(idf_py):
@ -138,7 +139,7 @@ def test_idf_copy(idf_copy):
@pytest.mark.usefixtures('test_app_copy')
def test_build_jsons_updated_by_reconfigure(idf_py):
globs = ['build/*.json']
idf_py('reconfigure')
snapshot_1 = get_snapshot(globs)
snapshot_2 = get_snapshot(globs)

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
# NOTE: unittest is by default sorting tests based on their names,
# so the order if which the tests are started may be different from
@ -15,7 +15,7 @@ import subprocess
import sys
import tempfile
import unittest
from typing import List
from typing import List # noqa: F401
try:
import idf_tools
@ -85,7 +85,7 @@ class BasePythonInstall(unittest.TestCase):
# Wheel for foopackage-0.99-py3-none-any.whl
# This is dummy package for testing purposes created with
# python -m build --wheel for the following package
'''
"""
├── foopackage
│   └── __init__.py
└── setup.py
@ -101,79 +101,82 @@ class BasePythonInstall(unittest.TestCase):
__init__.py
if __name__ == '__main__':
return
'''
"""
whl = (b'PK\x03\x04\x14\x00\x00\x00\x08\x00\x07fqVz|E\t&\x00\x00\x00&\x00\x00\x00\x16\x00\x00\x00'
b'foopackage/__init__.py\xcbLS\x88\x8f\xcfK\xccM\x8d\x8fW\xb0\xb5UP\x8f\x8f\xcfM\xcc\xcc\x8b\x8fW'
b'\xb7\xe2R\x00\x82\xa2\xd4\x92\xd2\xa2<.\x00PK\x03\x04\x14\x00\x00\x00\x08\x00%fqV\x8d\x90\x81\x05'
b'1\x00\x00\x006\x00\x00\x00"\x00\x00\x00foopackage-0.99.dist-info/METADATA\xf3M-ILI,I\xd4\rK-*\xce'
b'\xcc\xcf\xb3R0\xd23\xe4\xf2K\xccM\xb5RH\xcb\xcf/HL\xceNLO\xe5\x82\xcb\x1a\xe8YZrq\x01\x00PK\x03\x04'
b'\x14\x00\x00\x00\x08\x00%fqVI\xa2!\xcb\\\x00\x00\x00\\\x00\x00\x00\x1f\x00\x00\x00foopackage-0.99'
b'.dist-info/WHEEL\x0b\xcfHM\xcd\xd1\rK-*\xce\xcc\xcf\xb3R0\xd43\xe0rO\xcdK-J,\xc9/\xb2RHJ\xc9,.\x89/'
b'\x07\xa9Q\xd00\xd031\xd03\xd0\xe4\n\xca\xcf/\xd1\xf5,\xd6\r(-J\xcd\xc9L\xb2R()*M\xe5\nIL\xb7R(\xa84'
b'\xd6\xcd\xcb\xcfK\xd5M\xcc\xab\xe4\xe2\x02\x00PK\x03\x04\x14\x00\x00\x00\x08\x00%fqVI*\x9e\xa7\r\x00'
b'\x00\x00\x0b\x00\x00\x00\'\x00\x00\x00foopackage-0.99.dist-info/top_level.txtK\xcb\xcf/HL\xceNLO\xe5'
b'\x02\x00PK\x03\x04\x14\x00\x00\x00\x08\x00%fqV&\xdc\x9b\x88\xfd\x00\x00\x00}\x01\x00\x00 \x00\x00\x00'
b'foopackage-0.99.dist-info/RECORD}\xcc;\x92\x820\x00\x00\xd0\xde\xb3\x04\xe4#\xbfb\x8b\xac\xb0\x0b,'
b'\xa8\x83\x02#M&\x08\x81\x80\x02c\x02\x82\xa7\xb7rK\xdf\x01\x1e\xe9\xfb\x01_Z\\\x95k\x84hG9B\xe2\xb0'
b'\x00VcE\xd3\xbf\xf4\xe6\xe1\t6a2\xc3\x16N\x06]1Bm\xb7\x17\xc2Z\xef\xaa\xed\xf6\x9c\xdaQ \xd0\xf6\xc6'
b':\xec\x00\xd5\\\x91\xffL\x90D\xcb\x12\x0b\xca\xb8@;\xd2\xafC\xe7\x04mx\x82\xef\xb8\xf2\xc6"\xd9\xdd'
b'\r\x18\xe4\xcd\xef=\xf7\n7\x9eg4?\xa7\x04V*gXI\xff\xcanD\xc1\xf1\xc0\x80\xb6\xf9\x10\xa7\xae\xe3\x04'
b'\xefuh/<;?\xe3\xe3\x06\x9e\x93N/|\xc1Puc\xefgt\xfaQJ3\x82V\x8e\xb2\xef\x86\x12\xd9\x04\x96\xf2a\xe5'
b'\xfd\x80\xae\xe5T^E>\xf3\xf7\x1eW\x122\xe4\x91\xfbi\x1f\xd6\xeem\x99\xd4\xec\x11Ju\x9d\'R\xc83R\x19>'
b'jbO:\xb8\x8b\td\xf9\xc3\x1e9\xdb}d\x03\xb0z\x01PK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00\x07fqVz|E\t'
b'&\x00\x00\x00&\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00'
b'foopackage/__init__.pyPK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00%fqV\x8d\x90\x81\x051\x00\x00\x006\x00'
b'\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81Z\x00\x00\x00foopackage-0.99.dist-info'
b'/METADATAPK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00%fqVI\xa2!\xcb\\\x00\x00\x00\\\x00\x00\x00\x1f\x00'
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\xcb\x00\x00\x00foopackage-0.99.dist-info/WHEELPK\x01'
b'\x02\x14\x03\x14\x00\x00\x00\x08\x00%fqVI*\x9e\xa7\r\x00\x00\x00\x0b\x00\x00\x00\'\x00\x00\x00\x00\x00'
b'\x00\x00\x00\x00\x00\x00\xa4\x81d\x01\x00\x00foopackage-0.99.dist-info/top_level.txtPK\x01\x02\x14\x03'
b'\x14\x00\x00\x00\x08\x00%fqV&\xdc\x9b\x88\xfd\x00\x00\x00}\x01\x00\x00 \x00\x00\x00\x00\x00\x00\x00'
b'\x00\x00\x00\x00\xb4\x81\xb6\x01\x00\x00foopackage-0.99.dist-info/RECORDPK\x05\x06\x00\x00\x00\x00\x05'
b'\x00\x05\x00\x84\x01\x00\x00\xf1\x02\x00\x00\x00\x00')
whl = (
b'PK\x03\x04\x14\x00\x00\x00\x08\x00\x07fqVz|E\t&\x00\x00\x00&\x00\x00\x00\x16\x00\x00\x00'
b'foopackage/__init__.py\xcbLS\x88\x8f\xcfK\xccM\x8d\x8fW\xb0\xb5UP\x8f\x8f\xcfM\xcc\xcc\x8b\x8fW'
b'\xb7\xe2R\x00\x82\xa2\xd4\x92\xd2\xa2<.\x00PK\x03\x04\x14\x00\x00\x00\x08\x00%fqV\x8d\x90\x81\x05'
b'1\x00\x00\x006\x00\x00\x00"\x00\x00\x00foopackage-0.99.dist-info/METADATA\xf3M-ILI,I\xd4\rK-*\xce'
b'\xcc\xcf\xb3R0\xd23\xe4\xf2K\xccM\xb5RH\xcb\xcf/HL\xceNLO\xe5\x82\xcb\x1a\xe8YZrq\x01\x00PK\x03\x04'
b'\x14\x00\x00\x00\x08\x00%fqVI\xa2!\xcb\\\x00\x00\x00\\\x00\x00\x00\x1f\x00\x00\x00foopackage-0.99'
b'.dist-info/WHEEL\x0b\xcfHM\xcd\xd1\rK-*\xce\xcc\xcf\xb3R0\xd43\xe0rO\xcdK-J,\xc9/\xb2RHJ\xc9,.\x89/'
b'\x07\xa9Q\xd00\xd031\xd03\xd0\xe4\n\xca\xcf/\xd1\xf5,\xd6\r(-J\xcd\xc9L\xb2R()*M\xe5\nIL\xb7R(\xa84'
b'\xd6\xcd\xcb\xcfK\xd5M\xcc\xab\xe4\xe2\x02\x00PK\x03\x04\x14\x00\x00\x00\x08\x00%fqVI*\x9e\xa7\r\x00'
b"\x00\x00\x0b\x00\x00\x00'\x00\x00\x00foopackage-0.99.dist-info/top_level.txtK\xcb\xcf/HL\xceNLO\xe5"
b'\x02\x00PK\x03\x04\x14\x00\x00\x00\x08\x00%fqV&\xdc\x9b\x88\xfd\x00\x00\x00}\x01\x00\x00 \x00\x00\x00'
b'foopackage-0.99.dist-info/RECORD}\xcc;\x92\x820\x00\x00\xd0\xde\xb3\x04\xe4#\xbfb\x8b\xac\xb0\x0b,'
b'\xa8\x83\x02#M&\x08\x81\x80\x02c\x02\x82\xa7\xb7rK\xdf\x01\x1e\xe9\xfb\x01_Z\\\x95k\x84hG9B\xe2\xb0'
b'\x00VcE\xd3\xbf\xf4\xe6\xe1\t6a2\xc3\x16N\x06]1Bm\xb7\x17\xc2Z\xef\xaa\xed\xf6\x9c\xdaQ \xd0\xf6\xc6'
b':\xec\x00\xd5\\\x91\xffL\x90D\xcb\x12\x0b\xca\xb8@;\xd2\xafC\xe7\x04mx\x82\xef\xb8\xf2\xc6"\xd9\xdd'
b'\r\x18\xe4\xcd\xef=\xf7\n7\x9eg4?\xa7\x04V*gXI\xff\xcanD\xc1\xf1\xc0\x80\xb6\xf9\x10\xa7\xae\xe3\x04'
b'\xefuh/<;?\xe3\xe3\x06\x9e\x93N/|\xc1Puc\xefgt\xfaQJ3\x82V\x8e\xb2\xef\x86\x12\xd9\x04\x96\xf2a\xe5'
b"\xfd\x80\xae\xe5T^E>\xf3\xf7\x1eW\x122\xe4\x91\xfbi\x1f\xd6\xeem\x99\xd4\xec\x11Ju\x9d'R\xc83R\x19>"
b'jbO:\xb8\x8b\td\xf9\xc3\x1e9\xdb}d\x03\xb0z\x01PK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00\x07fqVz|E\t'
b'&\x00\x00\x00&\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00'
b'foopackage/__init__.pyPK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00%fqV\x8d\x90\x81\x051\x00\x00\x006\x00'
b'\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81Z\x00\x00\x00foopackage-0.99.dist-info'
b'/METADATAPK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00%fqVI\xa2!\xcb\\\x00\x00\x00\\\x00\x00\x00\x1f\x00'
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\xcb\x00\x00\x00foopackage-0.99.dist-info/WHEELPK\x01'
b"\x02\x14\x03\x14\x00\x00\x00\x08\x00%fqVI*\x9e\xa7\r\x00\x00\x00\x0b\x00\x00\x00'\x00\x00\x00\x00\x00"
b'\x00\x00\x00\x00\x00\x00\xa4\x81d\x01\x00\x00foopackage-0.99.dist-info/top_level.txtPK\x01\x02\x14\x03'
b'\x14\x00\x00\x00\x08\x00%fqV&\xdc\x9b\x88\xfd\x00\x00\x00}\x01\x00\x00 \x00\x00\x00\x00\x00\x00\x00'
b'\x00\x00\x00\x00\xb4\x81\xb6\x01\x00\x00foopackage-0.99.dist-info/RECORDPK\x05\x06\x00\x00\x00\x00\x05'
b'\x00\x05\x00\x84\x01\x00\x00\xf1\x02\x00\x00\x00\x00'
)
return self.dump_package(whl, 'foopackage-0.99-py3-none-any.whl')
def dump_foopackage_dev(self): # type: () -> str
# similar to dump_foopackage, but using dev release version
whl = (b'PK\x03\x04\x14\x00\x00\x00\x08\x00\nl\x03W !Z\xfc%\x00\x00\x00%\x00\x00\x00\x16\x00\x00\x00'
b'foopackage/__init__.py\xcbLS\x88\x8f\xcfK\xccM\x8d\x8fW\xb0\xb5UP\x8f\x8f\xcfM\xcc\xcc\x8b\x8fW\xb7'
b'\xe2R\x00\x82\xa2\xd4\x92\xd2\xa2<\x00PK\x03\x04\x14\x00\x00\x00\x08\x00Jl\x03W\xb4wO\x876\x00\x00'
b'\x00;\x00\x00\x00\'\x00\x00\x00foopackage-0.99.dev0.dist-info/METADATA\xf3M-ILI,I\xd4\rK-*\xce\xcc'
b'\xcf\xb3R0\xd23\xe4\xf2K\xccM\xb5RH\xcb\xcf/HL\xceNLO\xe5\x82\xcb\x1a\xe8YZ\xea\xa5\xa4\x96\x19pq'
b'\x01\x00PK\x03\x04\x14\x00\x00\x00\x08\x00Jl\x03W\xda9\xe8\xb4[\x00\x00\x00\\\x00\x00\x00$\x00\x00'
b'\x00foopackage-0.99.dev0.dist-info/WHEEL\x0b\xcfHM\xcd\xd1\rK-*\xce\xcc\xcf\xb3R0\xd43\xe0rO\xcdK-J,'
b'\xc9/\xb2RHJ\xc9,.\x89/\x07\xa9Q\xd00\xd03\x01Jkr\x05\xe5\xe7\x97\xe8z\x16\xeb\x06\x94\x16\xa5\xe6'
b'd&Y)\x94\x14\x95\xa6r\x85$\xa6[)\x14T\x1a\xeb\xe6\xe5\xe7\xa5\xea&\xe6Urq\x01\x00PK\x03\x04\x14\x00'
b'\x00\x00\x08\x00Jl\x03WI*\x9e\xa7\r\x00\x00\x00\x0b\x00\x00\x00,\x00\x00\x00foopackage-0.99.dev0'
b'.dist-info/top_level.txtK\xcb\xcf/HL\xceNLO\xe5\x02\x00PK\x03\x04\x14\x00\x00\x00\x08\x00Jl\x03W'
b'\x1e\xbaW\xb5\x00\x01\x00\x00\x91\x01\x00\x00%\x00\x00\x00foopackage-0.99.dev0.dist-info/RECORD\x85'
b'\xcd\xbbv\x820\x00\x00\xd0\xddo\t\x18\xe4\x08d\xe8\x80\x88"\xf2\xb0T\xe4\xb1\xe4\x08\x06B\xa1\x064F'
b'\xe8\xd7w\xb2\xab?po\xc5X\x7f.\xdbsM\xe6\x187\xd7\x86c,\xf7\x13\xb8\xd3\xf3b\xa9}d\x98\x90\xc1\n\xbc'
b'[m\xea\x0fI\x848\xda\xb1\x80)\xf5-D\xc7&\xcc\x9d\xe8\xa1\x1f\nj\x97\xbdZ\x02U\x9fU\xff\x98\x04e\x84'
b'\xe4\x0b\x11P\xbe4w.5\xd7\x8a\xcd}\xfbh\xae\xcd\xa3\xf9\xd2]\xb1jQ4$^?\xe6\xd9\xe4C\xb6\xdfdE3\x89'
b'\xb1m\x8dt0\xb2.6s[B\xbb_-\x03K\xf4NO\x1c\xdb\xf6^\xb4\xc9W[\xed+\xf5\xd4\xfd\x06\x0b\x18\x8c^\x05'
b'\t\x9dN!\x85%\xeb.\x92[\xb8Y\x1al\xd9\xcd\xd2>\x01Z\xbc\xa39\xebqG\x04\xe9d>\xf2W\x11\xd7\x10\xeb'
b'\xca\x83\xbb\t\xf3\xa9\xf33\t5\x7f\xfa\x90\xd2\xe2\x04}\x9eW\xb5\xee\xe2\xefx\x07\x0f\xced\x00EyWD'
b'\xb6\x15Fk\x00f\x7fPK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00\nl\x03W !Z\xfc%\x00\x00\x00%\x00\x00'
b'\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00foopackage/__init__.py'
b'PK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03W\xb4wO\x876\x00\x00\x00;\x00\x00\x00\'\x00\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81Y\x00\x00\x00foopackage-0.99.dev0.dist-info/METADATAPK\x01'
b'\x02\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03W\xda9\xe8\xb4[\x00\x00\x00\\\x00\x00\x00$\x00\x00\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\xa4\x81\xd4\x00\x00\x00foopackage-0.99.dev0.dist-info/WHEELPK\x01\x02'
b'\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03WI*\x9e\xa7\r\x00\x00\x00\x0b\x00\x00\x00,\x00\x00\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\xa4\x81q\x01\x00\x00foopackage-0.99.dev0.dist-info/top_level.txtPK\x01'
b'\x02\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03W\x1e\xbaW\xb5\x00\x01\x00\x00\x91\x01\x00\x00%\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb4\x81\xc8\x01\x00\x00foopackage-0.99.dev0.dist-info/RECORDPK'
b'\x05\x06\x00\x00\x00\x00\x05\x00\x05\x00\x98\x01\x00\x00\x0b\x03\x00\x00\x00\x00')
whl = (
b'PK\x03\x04\x14\x00\x00\x00\x08\x00\nl\x03W !Z\xfc%\x00\x00\x00%\x00\x00\x00\x16\x00\x00\x00'
b'foopackage/__init__.py\xcbLS\x88\x8f\xcfK\xccM\x8d\x8fW\xb0\xb5UP\x8f\x8f\xcfM\xcc\xcc\x8b\x8fW\xb7'
b'\xe2R\x00\x82\xa2\xd4\x92\xd2\xa2<\x00PK\x03\x04\x14\x00\x00\x00\x08\x00Jl\x03W\xb4wO\x876\x00\x00'
b"\x00;\x00\x00\x00'\x00\x00\x00foopackage-0.99.dev0.dist-info/METADATA\xf3M-ILI,I\xd4\rK-*\xce\xcc"
b'\xcf\xb3R0\xd23\xe4\xf2K\xccM\xb5RH\xcb\xcf/HL\xceNLO\xe5\x82\xcb\x1a\xe8YZ\xea\xa5\xa4\x96\x19pq'
b'\x01\x00PK\x03\x04\x14\x00\x00\x00\x08\x00Jl\x03W\xda9\xe8\xb4[\x00\x00\x00\\\x00\x00\x00$\x00\x00'
b'\x00foopackage-0.99.dev0.dist-info/WHEEL\x0b\xcfHM\xcd\xd1\rK-*\xce\xcc\xcf\xb3R0\xd43\xe0rO\xcdK-J,'
b'\xc9/\xb2RHJ\xc9,.\x89/\x07\xa9Q\xd00\xd03\x01Jkr\x05\xe5\xe7\x97\xe8z\x16\xeb\x06\x94\x16\xa5\xe6'
b'd&Y)\x94\x14\x95\xa6r\x85$\xa6[)\x14T\x1a\xeb\xe6\xe5\xe7\xa5\xea&\xe6Urq\x01\x00PK\x03\x04\x14\x00'
b'\x00\x00\x08\x00Jl\x03WI*\x9e\xa7\r\x00\x00\x00\x0b\x00\x00\x00,\x00\x00\x00foopackage-0.99.dev0'
b'.dist-info/top_level.txtK\xcb\xcf/HL\xceNLO\xe5\x02\x00PK\x03\x04\x14\x00\x00\x00\x08\x00Jl\x03W'
b'\x1e\xbaW\xb5\x00\x01\x00\x00\x91\x01\x00\x00%\x00\x00\x00foopackage-0.99.dev0.dist-info/RECORD\x85'
b'\xcd\xbbv\x820\x00\x00\xd0\xddo\t\x18\xe4\x08d\xe8\x80\x88"\xf2\xb0T\xe4\xb1\xe4\x08\x06B\xa1\x064F'
b'\xe8\xd7w\xb2\xab?po\xc5X\x7f.\xdbsM\xe6\x187\xd7\x86c,\xf7\x13\xb8\xd3\xf3b\xa9}d\x98\x90\xc1\n\xbc'
b'[m\xea\x0fI\x848\xda\xb1\x80)\xf5-D\xc7&\xcc\x9d\xe8\xa1\x1f\nj\x97\xbdZ\x02U\x9fU\xff\x98\x04e\x84'
b'\xe4\x0b\x11P\xbe4w.5\xd7\x8a\xcd}\xfbh\xae\xcd\xa3\xf9\xd2]\xb1jQ4$^?\xe6\xd9\xe4C\xb6\xdfdE3\x89'
b'\xb1m\x8dt0\xb2.6s[B\xbb_-\x03K\xf4NO\x1c\xdb\xf6^\xb4\xc9W[\xed+\xf5\xd4\xfd\x06\x0b\x18\x8c^\x05'
b'\t\x9dN!\x85%\xeb.\x92[\xb8Y\x1al\xd9\xcd\xd2>\x01Z\xbc\xa39\xebqG\x04\xe9d>\xf2W\x11\xd7\x10\xeb'
b'\xca\x83\xbb\t\xf3\xa9\xf33\t5\x7f\xfa\x90\xd2\xe2\x04}\x9eW\xb5\xee\xe2\xefx\x07\x0f\xced\x00EyWD'
b'\xb6\x15Fk\x00f\x7fPK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00\nl\x03W !Z\xfc%\x00\x00\x00%\x00\x00'
b'\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00foopackage/__init__.py'
b"PK\x01\x02\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03W\xb4wO\x876\x00\x00\x00;\x00\x00\x00'\x00\x00\x00"
b'\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81Y\x00\x00\x00foopackage-0.99.dev0.dist-info/METADATAPK\x01'
b'\x02\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03W\xda9\xe8\xb4[\x00\x00\x00\\\x00\x00\x00$\x00\x00\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\xa4\x81\xd4\x00\x00\x00foopackage-0.99.dev0.dist-info/WHEELPK\x01\x02'
b'\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03WI*\x9e\xa7\r\x00\x00\x00\x0b\x00\x00\x00,\x00\x00\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\xa4\x81q\x01\x00\x00foopackage-0.99.dev0.dist-info/top_level.txtPK\x01'
b'\x02\x14\x03\x14\x00\x00\x00\x08\x00Jl\x03W\x1e\xbaW\xb5\x00\x01\x00\x00\x91\x01\x00\x00%\x00\x00'
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb4\x81\xc8\x01\x00\x00foopackage-0.99.dev0.dist-info/RECORDPK'
b'\x05\x06\x00\x00\x00\x00\x05\x00\x05\x00\x98\x01\x00\x00\x0b\x03\x00\x00\x00\x00'
)
return self.dump_package(whl, 'foopackage-0.99.dev0-py3-none-any.whl')
class TestPythonInstall(BasePythonInstall):
def setUp(self): # type: () -> None
if os.path.isdir(PYTHON_DIR):
shutil.rmtree(PYTHON_DIR)
@ -183,7 +186,7 @@ class TestPythonInstall(BasePythonInstall):
def test_default_arguments(self): # type: () -> None
output = self.run_idf_tools(['check-python-dependencies'])
self.assertNotIn(REQ_SATISFIED, output)
self.assertIn(f'{PYTHON_BINARY} doesn\'t exist', output)
self.assertIn(f"{PYTHON_BINARY} doesn't exist", output)
output = self.run_idf_tools(['install-python-env'])
self.assertIn(CONSTR, output)
@ -219,7 +222,6 @@ class TestPythonInstall(BasePythonInstall):
class TestCustomPythonPathInstall(BasePythonInstall):
def setUp(self): # type: () -> None
self.CUSTOM_PYTHON_DIR = tempfile.mkdtemp()
self.environ_old = os.environ.copy()
@ -244,7 +246,6 @@ class TestCustomPythonPathInstall(BasePythonInstall):
class TestCheckPythonDependencies(BasePythonInstall):
"""
The constraint file name is available as the constraint_file attribute. The content of the file is changed by these
tests. The backup_constraint_file is a temporary file with the content of the original constraint file. This is
@ -252,6 +253,7 @@ class TestCheckPythonDependencies(BasePythonInstall):
important for consequent tests which should not download a new one especially when the test was run with a custom
constraint file different from the one on dl.espressif.com.
"""
constraint_file: str
backup_constraint_file: str