|
7 | 7 | from . import update_mphalport
|
8 | 8 |
|
9 | 9 |
|
| 10 | +IDF_VER = '5.2.0' |
| 11 | + |
| 12 | + |
10 | 13 | def get_partition_file_name(otp):
|
11 | 14 | if 'Running cmake in directory ' in otp:
|
12 | 15 | build_path = otp.split('Running cmake in directory ', 1)[-1]
|
@@ -128,7 +131,7 @@ def get_espidf():
|
128 | 131 | ]
|
129 | 132 | ]
|
130 | 133 | print()
|
131 |
| - print('collecting ESP-IDF v5.2.0') |
| 134 | + print(f'collecting ESP-IDF v{IDF_VER}') |
132 | 135 | print('this might take a while...')
|
133 | 136 | result, _ = spawn(cmd, spinner=True)
|
134 | 137 | if result != 0:
|
@@ -466,7 +469,9 @@ def has_correct_idf():
|
466 | 469 | if version:
|
467 | 470 | cached_idf_version = version
|
468 | 471 |
|
469 |
| - return cached_idf_version is not None and cached_idf_version == '5.2.0' |
| 472 | + return ( |
| 473 | + cached_idf_version is not None and cached_idf_version == IDF_VER |
| 474 | + ) |
470 | 475 |
|
471 | 476 |
|
472 | 477 | def build_manifest(
|
@@ -587,7 +592,9 @@ def setup_idf_environ():
|
587 | 592 |
|
588 | 593 | args = " ".join(args)
|
589 | 594 |
|
590 |
| - sys.stderr.write('ESP-IDF version 5.2.0 is needed to compile\n') |
| 595 | + sys.stderr.write( |
| 596 | + f'ESP-IDF version {IDF_VER} is needed to compile\n' |
| 597 | + ) |
591 | 598 | sys.stderr.write(
|
592 | 599 | 'Please rerun the build using the command below...\n'
|
593 | 600 | )
|
@@ -663,7 +670,7 @@ def submodules():
|
663 | 670 | ['./install.sh', 'all']
|
664 | 671 | ]
|
665 | 672 |
|
666 |
| - print('setting up ESP-IDF v5.2.0') |
| 673 | + print(f'setting up ESP-IDF v{IDF_VER}') |
667 | 674 | print('this might take a while...')
|
668 | 675 | env = {k: v for k, v in os.environ.items()}
|
669 | 676 | env['IDF_PATH'] = os.path.abspath(idf_path)
|
@@ -928,7 +935,18 @@ def compile(): # NOQA
|
928 | 935 | output = output.rsplit('To flash, run:')[-1].strip()
|
929 | 936 |
|
930 | 937 | espressif_path = os.path.expanduser('~/.espressif')
|
931 |
| - python_path = f'{espressif_path}/python_env/idf5.2_py3.10_env/bin' |
| 938 | + |
| 939 | + for ver in ('3.8', '3.9', '3.10', '3.11', '3.12'): |
| 940 | + python_path = ( |
| 941 | + f'{espressif_path}/python_env/idf{IDF_VER[:-2]}_py{ver}_env/bin' |
| 942 | + ) |
| 943 | + if os.path.exists(python_path): |
| 944 | + break |
| 945 | + else: |
| 946 | + raise RuntimeError( |
| 947 | + 'unable to locate pyton version used in the ESP-IDF' |
| 948 | + ) |
| 949 | + |
932 | 950 | python_path += '/python'
|
933 | 951 |
|
934 | 952 | output = output.split('python ', 1)[-1]
|
|
0 commit comments