Lines Matching +full:- +full:- +full:non +full:- +full:interactive
2 # coding=utf-8
4 # SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
6 # SPDX-License-Identifier: Apache-2.0
8 # This script helps installing tools required to use the ESP-IDF, and updating PATH
25 # * To install the Python environment, run `idf_tools.py install-python-env`.
80 IDF_ENV_FILE = 'idf-env.json'
93 PYTHON_PLATFORM = platform.system() + '-' + platform.machine()
99 PLATFORM_MACOS_ARM64 = 'macos-arm64'
100 PLATFORM_LINUX32 = 'linux-i686'
101 PLATFORM_LINUX64 = 'linux-amd64'
102 PLATFORM_LINUX_ARM32 = 'linux-armel'
103 PLATFORM_LINUX_ARMHF = 'linux-armhf'
104 PLATFORM_LINUX_ARM64 = 'linux-arm64'
108 # This includes strings produced from "platform.system() + '-' + platform.machine()", see PYTHON_PL…
110 # This list also includes various strings used in release archives of xtensa-esp32-elf-gcc, OpenOCD…
114 'Windows-i686': PLATFORM_WIN32,
115 'Windows-x86': PLATFORM_WIN32,
117 'Windows-x86_64': PLATFORM_WIN64,
118 'Windows-AMD64': PLATFORM_WIN64,
123 'Darwin-x86_64': PLATFORM_MACOS,
125 'Darwin-arm64': PLATFORM_MACOS_ARM64,
129 'Linux-x86_64': PLATFORM_LINUX64,
130 'FreeBSD-amd64': PLATFORM_LINUX64,
133 'Linux-i686': PLATFORM_LINUX32,
134 'FreeBSD-i386': PLATFORM_LINUX32,
136 'Linux-arm': PLATFORM_LINUX_ARM32,
137 'Linux-armv7l': PLATFORM_LINUX_ARM32,
140 'Linux-arm64': PLATFORM_LINUX_ARM64,
141 'Linux-aarch64': PLATFORM_LINUX_ARM64,
142 'Linux-armv8l': PLATFORM_LINUX_ARM64,
149 EXPORT_KEY_VALUE = 'key-value'
152 -----BEGIN CERTIFICATE-----
182 -----END CERTIFICATE-----
193 def fatal(text, *args): # type: (str, str) -> None
198 def warn(text, *args): # type: (str, str) -> None
203 def info(text, f=None, *args): # type: (str, Optional[IO[str]], str) -> None
211 # type: (list[str], Optional[str], Optional[list[str]]) -> bytes
247 def to_shell_specific_paths(paths_list): # type: (list[str]) -> list[str]
252 paths_msys = run_cmd_check_output(['cygpath', '-u', '-f', '-'],
259 def get_env_for_extra_paths(extra_paths): # type: (list[str]) -> dict[str, str]
273 def get_file_size_sha256(filename, block_size=65536): # type: (str, int) -> Tuple[int, str]
283 def report_progress(count, block_size, total_size): # type: (int, int, int) -> None
290 def mkdir_p(path): # type: (str) -> None
298 def unpack(filename, destination): # type: (str, str) -> None
315 def splittype(url): # type: (str) -> Tuple[Optional[str], str]
325 …al[Callable[[int, int, int], None]], Optional[bytes], Optional[SSLContext]) -> Tuple[str, addinfou…
346 size = int(headers.get('content-length', -1))
373 # https://github.com/espressif/esp-idf/issues/3819#issuecomment-515167118
374 # https://github.com/espressif/esp-idf/issues/4063#issuecomment-531490140
376 def rename_with_retry(path_from, path_to): # type: (str, str) -> None
384 if retry == retry_count - 1:
392 def strip_container_dirs(path, levels): # type: (str, int) -> None
431 def __init__(self, platform_name, url, size, sha256): # type: (str, str, int, str) -> None
447 def __init__(self, version, status): # type: (str, str) -> None
453 def __lt__(self, other): # type: (IDFToolVersion) -> bool
461 def __eq__(self, other): # type: (object) -> bool
466 def add_download(self, platform_name, url, size, sha256): # type: (str, str, int, str) -> None
469 def get_download_for_platform(self, platform_name): # type: (str) -> Optional[IDFToolDownload]
479 # type: (str) -> bool
482 def get_supported_platforms(self): # type: () -> set[str]
508 # type: (str, str, str, str, str, list[str], str, list[str], Optional[str], int) -> None
522 def copy_for_platform(self, platform): # type: (str) -> IDFTool
528 def _update_current_options(self): # type: () -> None
537 def add_version(self, version): # type: (IDFToolVersion) -> None
541 def get_path(self): # type: () -> str
544 def get_path_for_version(self, version): # type: (str) -> str
548 def get_export_paths(self, version): # type: (str) -> list[str]
552 def get_export_vars(self, version): # type: (str) -> dict[str, str]
556 - ${TOOL_PATH} => the actual path where the version is installed
567 def check_version(self, extra_paths=None): # type: (Optional[list[str]]) -> str
572 Raises ToolExecError if the tool returns with a non-zero exit code.
585 raise ToolExecError('returned non-zero exit code ({}) with error message:\n{}'.format(
586 e.returncode, e.stderr.decode('utf-8',errors='ignore'))) # type: ignore
588 in_str = version_cmd_result.decode('utf-8')
594 def get_install_type(self): # type: () -> Callable[[str], None]
597 def get_supported_targets(self): # type: () -> list[str]
600 def compatible_with_platform(self): # type: () -> bool
603 def get_supported_platforms(self): # type: () -> set[str]
609 def get_recommended_version(self): # type: () -> Optional[str]
618 def get_preferred_installed_version(self): # type: () -> Optional[str]
627 def find_installed_versions(self): # type: () -> None
670 def download(self, version): # type: (str) -> None
724 def install(self, version): # type: (str) -> None
743 def check_download_file(download_obj, local_path): # type: (IDFToolDownload, str) -> bool
756 …def from_json(cls, tool_dict): # type: (dict[str, Union[str, list[str], dict[str, str]]]) -> IDFT…
775 raise RuntimeError('version_regex for tool %s is not a non-empty string' % tool_name)
844 … raise RuntimeError('version_regex for override %d of tool %s is not a non-empty string' %
938 def load_tools_info(): # type: () -> dict[str, IDFTool]
940 Load tools metadata from tools.json, return a dictionary: tool name - tool info
980 def get_python_env_path(): # type: () -> Tuple[str, str, str]
997 match = re.match(r'^v([0-9]+\.[0-9]+).*', idf_version_str)
1034 def get_idf_env(): # type: () -> Any
1051 def export_targets_to_idf_env_json(targets): # type: (list[str]) -> None
1070 def clean_targets(targets_str): # type: (str) -> list[str]
1075 targets = targets_str.replace('-', '').split(',')
1089 def get_user_defined_targets(): # type: () -> list[str]
1105 def get_all_targets_from_tools_json(): # type: () -> list[str]
1118 def filter_tools_info(tools_info): # type: (OrderedDict[str, IDFTool]) -> OrderedDict[str,IDFTool]
1144 info(' - {} ({}{})'.format(version, version_obj.status,
1209 … (' --tools-json ' + args.tools_json) if args.tools_json else '')
1215 … prefer_system_hint = ' To use it, run \'{} export --prefer-system\''.format(self_restart_cmd)
1305 if --mirror-prefix-map flag or IDF_MIRROR_PREFIX_MAP environment variable is given.
1313 …warn('Both IDF_MIRROR_PREFIX_MAP environment variable and --mirror-prefix-map flag are specified, …
1319 … warn('invalid mirror-prefix-map item (missing \'{}\') {}'.format(URL_PREFIX_MAP_SEPARATOR, item))
1379 def is_tool_selected(tool): # type: (IDFTool) -> bool
1430 def is_tool_selected(tool): # type: (IDFTool) -> bool
1473 def get_wheels_dir(): # type: () -> Optional[str]
1475 wheels_package_name = 'idf-python-wheels'
1499 … subprocess.check_call([virtualenv_python, '--version'], stdout=sys.stdout, stderr=sys.stderr)
1501 …# At this point we can reinstall the virtual environment if it is non-functional. This can happen …
1506 …subprocess.check_call([virtualenv_python, '-m', 'pip', '--version'], stdout=sys.stdout, stderr=sys…
1519 subprocess.check_call([sys.executable, '-m', 'pip', '--version'])
1530 subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', 'virtualenv'],
1539 # check the version to determine if we should add --seeder option
1549 virtualenv_options = ['--python', sys.executable]
1551 virtualenv_options += ['--seeder', 'pip']
1553 subprocess.check_call([sys.executable, '-m', 'virtualenv',
1561 run_args = [virtualenv_python, '-m', 'pip', 'install', '--no-warn-script-location']
1563 run_args += ['-r', requirements_txt]
1565 run_args += ['--find-links', args.extra_wheels_dir]
1567 run_args += ['--no-index']
1569 run_args += ['--extra-index-url', args.extra_wheels_url]
1573 run_args += ['--find-links', wheels_dir]
1654 def print_out(text): # type: (str) -> None
1661 idf_gh_url = 'https://github.com/espressif/esp-idf'
1670 .. _tool-{name}:
1677 .. include:: idf-tools-notes.inc
1678 :start-after: tool-{name}-notes
1679 :end-before: ---
1685 .. list-table::
1687 :header-rows: 1
1689 * - Platform
1690 - Required
1691 - Download
1718 * - {}
1719 - {}
1720 - {}
1722 .. rst-class:: tool-sha256
1731 def main(argv): # type: (list[str]) -> None
1734 …parser.add_argument('--quiet', help='Don\'t output diagnostic messages to stdout/stderr', action='…
1735 …parser.add_argument('--non-interactive', help='Don\'t output interactive messages and questions', …
1736 parser.add_argument('--tools-json', help='Path to the tools.json file to use')
1737 parser.add_argument('--idf-path', help='ESP-IDF path to use')
1743 export.add_argument('--format', choices=[EXPORT_SHELL, EXPORT_KEY_VALUE], default=EXPORT_SHELL,
1745 'or key-value (suitable for parsing by other tools')
1746 … export.add_argument('--prefer-system', help='Normally, if the tool is already present in PATH, ' +
1756 …install.add_argument('--targets', default='all', help='A comma separated list of desired chip targ…
1760 download.add_argument('--platform', help='Platform to download the tools for')
1766 …download.add_argument('--targets', default='all', help='A comma separated list of desired chip tar…
1771 subparser.add_argument('--mirror-prefix-map', nargs='*',
1775 install_python_env = subparsers.add_parser('install-python-env',
1778 …install_python_env.add_argument('--reinstall', help='Discard the previously installed environment',
1780 … install_python_env.add_argument('--extra-wheels-dir', help='Additional directories with wheels ' +
1782 …install_python_env.add_argument('--extra-wheels-url', help='Additional URL with wheels', default='…
1783 … install_python_env.add_argument('--no-index', help='Work offline without retrieving wheels index')
1786 …add_version = subparsers.add_parser('add-version', help='Add or update download info for a version…
1787 add_version.add_argument('--output', help='Save new tools.json into this file')
1788 add_version.add_argument('--tool', help='Tool name to set add a version for', required=True)
1789 add_version.add_argument('--version', help='Version identifier', required=True)
1790 …add_version.add_argument('--url-prefix', help='String to prepend to file names to obtain download …
1794 rewrite.add_argument('--output', help='Save new tools.json into this file')
1798 … gen_doc = subparsers.add_parser('gen-doc', help='Write the list of tools as a documentation page')
1799 gen_doc.add_argument('--output', type=argparse.FileType('w'), default=sys.stdout,
1801 …gen_doc.add_argument('--heading-underline-char', help='Character to use when generating RST sectio…
1837 fatal('IDF_TOOLS_PATH contains non-ASCII characters: {}'.format(global_idf_tools_path) +
1852 action_func_name = 'action_' + args.action.replace('-', '_')