first commit
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,151 @@
|
||||
# macOS Certificate Issues in Python Downloads - Analysis and Solutions
|
||||
|
||||
## Common Causes of Certificate Problems on macOS:
|
||||
|
||||
### 1. **Outdated Python Certificates**
|
||||
- Python uses the `certifi` package for SSL certificates
|
||||
- These can become outdated, especially with older Python installations
|
||||
- **Solution**: `python3 -m pip install --upgrade certifi`
|
||||
|
||||
### 2. **macOS System Python (/usr/bin/python3) Issues**
|
||||
- Apple's standard Python uses system certificates from the Keychain
|
||||
- System updates can sometimes damage certificates
|
||||
- **Solution**: Export system certificates and set as SSL_CERT_FILE
|
||||
|
||||
### 3. **macOS Keychain Problems**
|
||||
- macOS manages certificates through the Keychain
|
||||
- System updates can sometimes corrupt certificates
|
||||
- **Solution**: Keychain Access → Certificate Assistant → Evaluate
|
||||
|
||||
### 4. **Python.org Certificates Not Installed**
|
||||
- With Python.org installations, certificates are often not installed automatically
|
||||
- **Solution**: Run `/Applications/Python\ 3.x/Install\ Certificates.command`
|
||||
|
||||
### 5. **Corporate/Proxy Environment**
|
||||
- Corporate proxies with their own certificates
|
||||
- **Solution**: Add corporate CA certificates to Python certificate store
|
||||
|
||||
## Standard macOS Python (/usr/bin/python3) Solutions:
|
||||
|
||||
```bash
|
||||
# 1. Export system certificates
|
||||
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain > /tmp/system_certs.pem
|
||||
|
||||
# 2. Set environment variable
|
||||
export SSL_CERT_FILE=/tmp/system_certs.pem
|
||||
|
||||
# 3. Update Python certifi for system Python
|
||||
/usr/bin/python3 -m pip install --user --upgrade certifi
|
||||
|
||||
# 4. Update the system
|
||||
# System Settings → General → Software Update
|
||||
|
||||
# 5. Test connection
|
||||
curl -v https://dl.espressif.com
|
||||
```
|
||||
|
||||
## Homebrew Python Solutions:
|
||||
|
||||
```bash
|
||||
# Install Homebrew CA certificates
|
||||
brew install ca-certificates
|
||||
|
||||
# Install OpenSSL
|
||||
brew install openssl
|
||||
|
||||
# Update Python certifi via Homebrew
|
||||
brew reinstall python-certifi
|
||||
|
||||
# Test Homebrew Python
|
||||
/opt/homebrew/bin/python3 -c "import ssl; print(ssl.get_default_verify_paths())"
|
||||
```
|
||||
|
||||
## Python.org Installation Solutions:
|
||||
|
||||
```bash
|
||||
# Run Install Certificates Command (if available)
|
||||
/Applications/Python\ 3.11/Install\ Certificates.command
|
||||
# or
|
||||
/Applications/Python\ 3.12/Install\ Certificates.command
|
||||
|
||||
# Manually update certifi
|
||||
python3 -m pip install --upgrade certifi
|
||||
```
|
||||
|
||||
## Debugging Commands for macOS:
|
||||
|
||||
```bash
|
||||
# Display Python SSL information
|
||||
python3 -c "import ssl, certifi; print('SSL:', ssl.OPENSSL_VERSION); print('Certifi:', certifi.where())"
|
||||
|
||||
# Update certificates
|
||||
python3 -m pip install --upgrade certifi
|
||||
|
||||
# Install Python.app certificates (if available)
|
||||
/Applications/Python\ 3.*/Install\ Certificates.command
|
||||
|
||||
# Homebrew CA certificates
|
||||
brew install ca-certificates
|
||||
|
||||
# Test HTTPS connection
|
||||
python3 -c "import urllib.request; urllib.request.urlopen('https://dl.espressif.com')"
|
||||
```
|
||||
|
||||
## Additional Solution Approaches:
|
||||
|
||||
### Set Environment Variables:
|
||||
```bash
|
||||
export SSL_CERT_FILE=$(python3 -m certifi)
|
||||
export REQUESTS_CA_BUNDLE=$(python3 -m certifi)
|
||||
```
|
||||
|
||||
### Bypass Corporate Proxy:
|
||||
```bash
|
||||
export https_proxy=""
|
||||
export HTTPS_PROXY=""
|
||||
```
|
||||
|
||||
### Manually Download Certificates:
|
||||
```bash
|
||||
# Manually add DigiCert Root CA
|
||||
curl -O https://cacerts.digicert.com/DigiCertGlobalRootG2.crt
|
||||
```
|
||||
|
||||
### Reset Certificate Cache:
|
||||
```bash
|
||||
# Clear pip and certificate caches
|
||||
sudo rm -rf /tmp/pip-* && rm -rf ~/.cache/pip
|
||||
```
|
||||
|
||||
## Python Installation Type Detection:
|
||||
|
||||
Different Python installations on macOS require different approaches:
|
||||
|
||||
### System Python (/usr/bin/python3):
|
||||
- Uses macOS system certificates
|
||||
- Requires system certificate export
|
||||
- Best approach: Extract system certificates and set SSL_CERT_FILE
|
||||
|
||||
### Homebrew Python (/opt/homebrew or /usr/local):
|
||||
- Uses Homebrew-managed certificates
|
||||
- Best approach: Update via brew install ca-certificates
|
||||
|
||||
### Python.org Installation (/Applications/Python):
|
||||
- Often missing certificates initially
|
||||
- Best approach: Run Install Certificates.command script
|
||||
|
||||
## Testing Your Solution:
|
||||
|
||||
```bash
|
||||
# Test 1: Basic SSL connection
|
||||
python3 -c "import ssl; ssl.create_default_context().check_hostname = True"
|
||||
|
||||
# Test 2: Download test
|
||||
python3 -c "import urllib.request; print('Success:', urllib.request.urlopen('https://dl.espressif.com').status)"
|
||||
|
||||
# Test 3: Certificate path verification
|
||||
python3 -c "import certifi; print('Certifi path:', certifi.where())"
|
||||
|
||||
# Test 4: System certificate access
|
||||
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain | head -20
|
||||
```
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Major version number (X.x.x) */
|
||||
#define ESP_IDF_VERSION_MAJOR 5
|
||||
/** Minor version number (x.X.x) */
|
||||
#define ESP_IDF_VERSION_MINOR 5
|
||||
/** Patch version number (x.x.X) */
|
||||
#define ESP_IDF_VERSION_PATCH 0
|
||||
|
||||
/**
|
||||
* Macro to convert IDF version number into an integer
|
||||
*
|
||||
* To be used in comparisons, such as ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
|
||||
*/
|
||||
#define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
|
||||
|
||||
/**
|
||||
* Current IDF version, as an integer
|
||||
*
|
||||
* To be used in comparisons, such as ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
|
||||
*/
|
||||
#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(ESP_IDF_VERSION_MAJOR, \
|
||||
ESP_IDF_VERSION_MINOR, \
|
||||
ESP_IDF_VERSION_PATCH)
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
/**
|
||||
* Return full IDF version string, same as 'git describe' output.
|
||||
*
|
||||
* @note If you are printing the ESP-IDF version in a log file or other information,
|
||||
* this function provides more information than using the numerical version macros.
|
||||
* For example, numerical version macros don't differentiate between development,
|
||||
* pre-release and release versions, but the output of this function does.
|
||||
*
|
||||
* @return constant string from IDF_VER
|
||||
*/
|
||||
const char* esp_get_idf_version(void);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "tool-esp_install",
|
||||
"version": "5.3.4",
|
||||
"description": "modified espressif installer tool: idf_tools.py",
|
||||
"keywords": [
|
||||
"tools",
|
||||
"installer"
|
||||
],
|
||||
"homepage": "https://github.com/pioarduino",
|
||||
"license": "Apache-2.0",
|
||||
"system": [
|
||||
"*"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pioarduino/esp_install"
|
||||
}
|
||||
}
|
||||
Executable
+150
@@ -0,0 +1,150 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
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.')
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
from importlib.metadata import requires
|
||||
from importlib.metadata import version as get_version
|
||||
except ImportError:
|
||||
# compatibility for python <=3.7
|
||||
from importlib_metadata import requires # type: ignore
|
||||
from importlib_metadata import version as get_version # type: ignore
|
||||
|
||||
try:
|
||||
from typing import Set
|
||||
except ImportError:
|
||||
# This is a script run during the early phase of setting up the environment. So try to avoid failure caused by
|
||||
# Python version incompatibility. The supported Python version is checked elsewhere.
|
||||
pass
|
||||
|
||||
PYTHON_PACKAGE_RE = re.compile(r'[^<>=~]+')
|
||||
|
||||
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')
|
||||
args = parser.parse_args()
|
||||
|
||||
required_set = set()
|
||||
for req_path in args.requirements:
|
||||
with open(req_path) as f:
|
||||
required_set |= set(i for i in map(str.strip, f.readlines()) if len(i) > 0 and not i.startswith('#'))
|
||||
|
||||
constr_dict = {} # for example package_name -> package_name==1.0
|
||||
for const_path in args.constraints:
|
||||
with open(const_path) as f:
|
||||
for con in [i for i in map(str.strip, f.readlines()) if len(i) > 0 and not i.startswith('#')]:
|
||||
if con.startswith('file://'):
|
||||
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
|
||||
con_m = re.search(r'#egg=([^\s]+)', con)
|
||||
if not con_m:
|
||||
print('Malformed input. Cannot find name in {}'.format(con))
|
||||
sys.exit(1)
|
||||
con = con_m[1]
|
||||
|
||||
name_m = PYTHON_PACKAGE_RE.search(con)
|
||||
if not name_m:
|
||||
print('Malformed input. Cannot find name in {}'.format(con))
|
||||
sys.exit(1)
|
||||
constr_dict[name_m[0]] = con.partition(' #')[0] # remove comments
|
||||
|
||||
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]
|
||||
|
||||
# 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
|
||||
# requirements to be checked on each level of breath-first-search of the package dependency tree. The initial
|
||||
# version is the direct dependencies deduced from the requirements arguments of the script.
|
||||
new_req_list = [Requirement(constr_dict.get(i, i)) for i in required_set]
|
||||
|
||||
def version_check(requirement: Requirement) -> None:
|
||||
# compare installed version with required
|
||||
version = Version(get_version(requirement.name))
|
||||
if not requirement.specifier.contains(version, prereleases=True):
|
||||
not_satisfied.append(f"Requirement '{requirement}' was not met. Installed version: {version}")
|
||||
|
||||
# evaluate markers and check versions of direct requirements
|
||||
for req in new_req_list[:]:
|
||||
if not req.marker or req.marker.evaluate():
|
||||
try:
|
||||
version_check(req)
|
||||
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}")
|
||||
new_req_list.remove(req)
|
||||
else:
|
||||
new_req_list.remove(req)
|
||||
|
||||
while new_req_list:
|
||||
req_list = new_req_list
|
||||
new_req_list = []
|
||||
already_checked.update(req_list)
|
||||
for requirement in req_list: # check one level of the dependency tree
|
||||
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
|
||||
for name in requires(requirement.name) or []:
|
||||
sub_req = Requirement(name)
|
||||
# check extras e.g. esptool[hsm]
|
||||
for extra in extras:
|
||||
# evaluate markers if present
|
||||
if not sub_req.marker or sub_req.marker.evaluate(environment={'extra': extra}):
|
||||
dependency_requirements.add(sub_req)
|
||||
version_check(sub_req)
|
||||
# dependency_requirements are the direct dependencies of "requirement". They belong to the next level
|
||||
# of the dependency tree. They will be checked only if they haven't been already. Note that the
|
||||
# version is taken into account as well because packages can have different requirements for a given
|
||||
# Python package. The dependencies need to be checked for all of them because they can be different.
|
||||
new_req_list.extend(dependency_requirements - already_checked)
|
||||
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}")
|
||||
|
||||
if len(not_satisfied) > 0:
|
||||
print('The following Python requirements are not satisfied:')
|
||||
print(os.linesep.join(not_satisfied))
|
||||
if 'IDF_PYTHON_ENV_PATH' in os.environ:
|
||||
# We are running inside a private virtual environment under IDF_TOOLS_PATH,
|
||||
# ask the user to run install.bat again.
|
||||
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('Diagnostic information:')
|
||||
idf_python_env_path = os.environ.get('IDF_PYTHON_ENV_PATH')
|
||||
print(' IDF_PYTHON_ENV_PATH: {}'.format(idf_python_env_path or '(not set)'))
|
||||
print(' Python interpreter used: {}'.format(sys.executable))
|
||||
if not idf_python_env_path or idf_python_env_path not in sys.executable:
|
||||
print(' Warning: python interpreter not running from IDF_PYTHON_ENV_PATH')
|
||||
print(' PATH: {}'.format(os.getenv('PATH')))
|
||||
sys.exit(1)
|
||||
|
||||
print('Python requirements are satisfied.')
|
||||
Executable
+3982
File diff suppressed because it is too large
Load Diff
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Script for checking the compatibility of the Python interpreter with ESP-IDF.
|
||||
#
|
||||
# There are related tools/detect_python.{sh,fish} scripts which are called earlier when the paths are not properly
|
||||
# set-up and they only intend to prefer the use of Python 3 over Python 2. Why not more? All possible executables
|
||||
# (python3.7, python3.8, ...) cannot be hardcoded there and at the end, the user is responsible to set-up a system
|
||||
# where "python" or "python3" of compatible version is available.
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
# Python 2 is not supported anymore but still the old way of typing is used here in order to give a nice Python
|
||||
# version failure and not a typing exception.
|
||||
from typing import Iterable
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
OLDEST_PYTHON_SUPPORTED = (3, 7) # keep it as tuple for comparison with sys.version_info
|
||||
|
||||
|
||||
def _ver_to_str(it): # type: (Iterable) -> str
|
||||
return '.'.join(str(x) for x in it)
|
||||
|
||||
|
||||
def is_supported(): # type: () -> bool
|
||||
return sys.version_info[:2] >= OLDEST_PYTHON_SUPPORTED[:2]
|
||||
|
||||
|
||||
def check(): # type: () -> None
|
||||
if not is_supported():
|
||||
raise RuntimeError(
|
||||
'ESP-IDF supports Python {} or newer but you are using Python {}. Please upgrade your '
|
||||
'installation as described in the documentation.'.format(
|
||||
_ver_to_str(OLDEST_PYTHON_SUPPORTED), _ver_to_str(sys.version_info[:3])
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
check()
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": 1,
|
||||
"features": [
|
||||
{
|
||||
"name": "core",
|
||||
"description": "Core packages necessary for ESP-IDF",
|
||||
"optional": false,
|
||||
"requirement_path": "tools/requirements/requirements.core.txt"
|
||||
},
|
||||
{
|
||||
"name": "gdbgui",
|
||||
"description": "Packages for supporting debugging from web browser",
|
||||
"optional": true,
|
||||
"requirement_path": "tools/requirements/requirements.gdbgui.txt"
|
||||
},
|
||||
{
|
||||
"name": "pytest",
|
||||
"description": "Packages for CI with pytest",
|
||||
"optional": true,
|
||||
"requirement_path": "tools/requirements/requirements.pytest.txt"
|
||||
},
|
||||
{
|
||||
"name": "ttfw",
|
||||
"description": "Packages for CI with ttfw",
|
||||
"optional": true,
|
||||
"requirement_path": "tools/requirements/requirements.ttfw.txt"
|
||||
},
|
||||
{
|
||||
"name": "ci",
|
||||
"description": "Packages for ESP-IDF CI scripts",
|
||||
"optional": true,
|
||||
"requirement_path": "tools/requirements/requirements.ci.txt"
|
||||
},
|
||||
{
|
||||
"name": "docs",
|
||||
"description": "Packages for building ESP-IDF documentation",
|
||||
"optional": true,
|
||||
"requirement_path": "tools/requirements/requirements.docs.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://github.com/espressif/esp-idf/blob/master/tools/requirements_schema.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "integer",
|
||||
"description": "Metadata file version"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"description": "List of features",
|
||||
"items": {
|
||||
"$ref": "#/definitions/featInfo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"version",
|
||||
"features"
|
||||
],
|
||||
"definitions": {
|
||||
"featInfo": {
|
||||
"type": "object",
|
||||
"description": "Information about one feature",
|
||||
"properties": {
|
||||
"name" : {
|
||||
"description": "Feature name",
|
||||
"type": "string"
|
||||
},
|
||||
"description" : {
|
||||
"description": "A short description of the feature",
|
||||
"type": "string"
|
||||
},
|
||||
"optional": {
|
||||
"description": "The feature is optional if the user can choose to not install it",
|
||||
"type": "boolean"
|
||||
},
|
||||
"requirement_path": {
|
||||
"description": "Path to the requirements file with Python packages",
|
||||
"type": "string",
|
||||
"pattern": "^tools/requirements/requirements\\..+\\.txt$"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"optional",
|
||||
"requirement_path"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://github.com/espressif/esp-idf/blob/master/tools/tools-schema.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "integer",
|
||||
"description": "Metadata file version"
|
||||
},
|
||||
"tools": {
|
||||
"type": "array",
|
||||
"description": "List of tools",
|
||||
"items": {
|
||||
"$ref": "#/definitions/toolInfo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"version",
|
||||
"tools"
|
||||
],
|
||||
"definitions": {
|
||||
"toolInfo": {
|
||||
"type": "object",
|
||||
"description": "Information about one tool",
|
||||
"properties": {
|
||||
"name" : {
|
||||
"description": "Tool name (used as a directory name)",
|
||||
"type": "string"
|
||||
},
|
||||
"description" : {
|
||||
"description": "A short (one sentence) description of the tool.",
|
||||
"type": "string"
|
||||
},
|
||||
"export_paths": {
|
||||
"$ref": "#/definitions/exportPaths"
|
||||
},
|
||||
"export_vars": {
|
||||
"$ref": "#/definitions/envVars",
|
||||
"description": "Some variable expansions are done on the values. 1) ${TOOL_PATH} is replaced with the directory where the tool is installed."
|
||||
},
|
||||
"info_url": {
|
||||
"description": "URL of the page with information about the tool",
|
||||
"type": "string"
|
||||
},
|
||||
"install": {
|
||||
"$ref": "#/definitions/installRequirementInfo",
|
||||
"description": "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation."
|
||||
},
|
||||
"is_executable": {
|
||||
"description": "If false - tool does not contain executables. The version will not be checked but export_vars applied.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"license": {
|
||||
"description": "License name. Use SPDX license identifier if it exists, short name of the license otherwise.",
|
||||
"type": "string"
|
||||
},
|
||||
"version_cmd": {
|
||||
"$ref": "#/definitions/arrayOfStrings",
|
||||
"description": "Command to be executed (along with any extra arguments). The executable be present in one of the export_paths."
|
||||
},
|
||||
"supported_targets": {
|
||||
"$ref": "#/definitions/arrayOfStrings",
|
||||
"description": "Array of esp_targets that this tool is needed for."
|
||||
},
|
||||
"version_regex": {
|
||||
"description": "Regex which is to be applied to version_cmd output to extract the version. By default, the version will be the first capture group of the expression. If version_regex_replace is specified, version will be obtained by doing a substitution using version_regex_replace instead.",
|
||||
"$ref": "#/definitions/regex"
|
||||
},
|
||||
"version_regex_replace": {
|
||||
"description": "If given, this will be used as substitute expression for the regex defined in version_regex, to obtain the version string. Not specifying this is equivalent to setting it to '\\1' (i.e. return the first capture group).",
|
||||
"type": "string"
|
||||
},
|
||||
"strip_container_dirs": {
|
||||
"type": "integer",
|
||||
"description": "If specified, this number of top directory levels will removed when extracting. E.g. if strip_container_dirs=2, archive path a/b/c/d.txt will be extracted as c/d.txt"
|
||||
},
|
||||
"versions": {
|
||||
"type": "array",
|
||||
"description": "List of versions",
|
||||
"items": {
|
||||
"$ref": "#/definitions/versionInfo"
|
||||
}
|
||||
},
|
||||
"platform_overrides": {
|
||||
"type": "array",
|
||||
"description": "List of platform-specific overrides",
|
||||
"items": {
|
||||
"$ref": "#/definitions/platformOverrideInfo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"description",
|
||||
"export_paths",
|
||||
"version_cmd",
|
||||
"version_regex",
|
||||
"versions",
|
||||
"install",
|
||||
"info_url",
|
||||
"license"
|
||||
]
|
||||
},
|
||||
"arrayOfStrings": {
|
||||
"description": "Array of strings. Used to represent paths (split into components) and command lines (split into arguments)",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"exportPaths": {
|
||||
"description": "Array of paths to be exported (added to PATH). Each item in the array is relative to the directory where the tool will be installed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/arrayOfStrings"
|
||||
}
|
||||
},
|
||||
"envVars": {
|
||||
"description": "Collection of environment variables. Keys and values are the environment variable names and values, respectively.",
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^([A-Z_0-9]+)+$": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"regex": {
|
||||
"description": "A regular expression",
|
||||
"type": "string"
|
||||
},
|
||||
"versionInfo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name" : {
|
||||
"description": "Version name (used as a directory name)",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "Determines whether the version is recommended/supported/deprecated",
|
||||
"type": "string",
|
||||
"enum": ["recommended", "supported", "deprecated"]
|
||||
},
|
||||
"linux-i686": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
},
|
||||
"linux-amd64": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
},
|
||||
"linux-armel": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
},
|
||||
"linux-arm64": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
},
|
||||
"macos": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
},
|
||||
"win32": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
},
|
||||
"win64": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
},
|
||||
"any": {
|
||||
"$ref": "#/definitions/platformDownloadInfo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"platformDownloadInfo": {
|
||||
"description": "Information about download artifact for one platform",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sha256": {
|
||||
"type": "string",
|
||||
"description": "SHA256 sum of the file"
|
||||
},
|
||||
"size": {
|
||||
"type": "integer",
|
||||
"description": "Size of the file, in bytes"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "Download URL"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"sha256",
|
||||
"url",
|
||||
"size"
|
||||
]
|
||||
},
|
||||
"installRequirementInfo": {
|
||||
"description": "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation.",
|
||||
"type": "string",
|
||||
"enum": ["always", "on_request", "never"]
|
||||
},
|
||||
"platformOverrideInfo": {
|
||||
"description": "Platform-specific values which override the defaults",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"platforms": {
|
||||
"description": "List of platforms to which this override applies",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["linux-i686", "linux-amd64", "linux-armel", "linux-arm64", "macos", "macos-arm64", "win32", "win64"]
|
||||
}
|
||||
},
|
||||
"export_paths": {
|
||||
"description": "Platform-specific replacement for toolInfo/export_paths",
|
||||
"$ref": "#/definitions/exportPaths"
|
||||
},
|
||||
"export_vars": {
|
||||
"description": "Platform-specific replacement for toolInfo/export_vars",
|
||||
"$ref": "#/definitions/envVars"
|
||||
},
|
||||
"install": {
|
||||
"description": "Platform-specific replacement for toolInfo/install",
|
||||
"$ref": "#/definitions/installRequirementInfo"
|
||||
},
|
||||
"version_cmd": {
|
||||
"description": "Platform-specific replacement for toolInfo/version_cmd",
|
||||
"$ref": "#/definitions/arrayOfStrings"
|
||||
},
|
||||
"supported_targets": {
|
||||
"description": "Platform-specific replacement for toolInfo/supported_targets",
|
||||
"$ref": "#/definitions/arrayOfStrings"
|
||||
},
|
||||
"version_regex": {
|
||||
"description": "Platform-specific replacement for toolInfo/version_regex",
|
||||
"$ref": "#/definitions/regex"
|
||||
},
|
||||
"version_regex_replace": {
|
||||
"description": "Platform-specific replacement for toolInfo/version_regex_replace",
|
||||
"type": "string"
|
||||
},
|
||||
"strip_container_dirs": {
|
||||
"type": "string",
|
||||
"description": "Platform-specific replacement for toolInfo/strip_container_dirs"
|
||||
}
|
||||
},
|
||||
"required": ["platforms"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user