mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
Merge branch 'bugfix/drop_make_support_when_esp32_not_supported' into 'master'
CI: drop make support when esp32 not supported See merge request espressif/esp-idf!11510
This commit is contained in:
@@ -51,12 +51,15 @@ def get_idf_path(path, *paths):
|
||||
|
||||
def _get_apps(target, build_system):
|
||||
print("- Getting paths of apps")
|
||||
output = subprocess.check_output(
|
||||
sys.executable + " " + os.getenv('IDF_PATH') +
|
||||
"/tools/find_apps.py -p examples --recursive --target %s --build-system %s"
|
||||
% (target, build_system),
|
||||
shell=True).decode('utf-8')
|
||||
o_list = output.split("\n")
|
||||
args = [sys.executable,
|
||||
get_idf_path('tools/find_apps.py'),
|
||||
'-p',
|
||||
get_idf_path('examples'),
|
||||
'--recursive',
|
||||
'--target', target,
|
||||
'--build-system', build_system]
|
||||
output = subprocess.check_output(args).decode('utf-8')
|
||||
o_list = output.split('\n')
|
||||
json_list = []
|
||||
for j in o_list:
|
||||
if j:
|
||||
|
@@ -146,9 +146,9 @@ def find_apps(build_system_class, path, recursive, exclude_list, target):
|
||||
logging.debug("Looking for {} apps in {}{}".format(build_system_name, path, " recursively" if recursive else ""))
|
||||
if not recursive:
|
||||
if exclude_list:
|
||||
logging.warn("--exclude option is ignored when used without --recursive")
|
||||
logging.warning("--exclude option is ignored when used without --recursive")
|
||||
if not build_system_class.is_app(path):
|
||||
logging.warn("Path {} specified without --recursive flag, but no {} app found there".format(
|
||||
logging.warning("Path {} specified without --recursive flag, but no {} app found there".format(
|
||||
path, build_system_name))
|
||||
return []
|
||||
return [path]
|
||||
@@ -168,12 +168,15 @@ def find_apps(build_system_class, path, recursive, exclude_list, target):
|
||||
del dirs[:]
|
||||
|
||||
supported_targets = build_system_class.supported_targets(root)
|
||||
if supported_targets and target not in supported_targets:
|
||||
logging.debug("Skipping, app only supports targets: " + ", ".join(supported_targets))
|
||||
if supported_targets and (target in supported_targets):
|
||||
apps_found.append(root)
|
||||
else:
|
||||
if supported_targets:
|
||||
logging.debug("Skipping, app only supports targets: " + ", ".join(supported_targets))
|
||||
else:
|
||||
logging.debug("Skipping, app has no supported targets")
|
||||
continue
|
||||
|
||||
apps_found.append(root)
|
||||
|
||||
return apps_found
|
||||
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -14,14 +13,6 @@ IDF_PY = os.path.join(os.environ["IDF_PATH"], "tools", "idf.py")
|
||||
# there is no equivalent for the project CMakeLists files. This seems to be the best option...
|
||||
CMAKE_PROJECT_LINE = r"include($ENV{IDF_PATH}/tools/cmake/project.cmake)"
|
||||
|
||||
SUPPORTED_TARGETS_REGEX = re.compile(r'Supported [Tt]argets((?:[\s|]+(?:ESP[0-9A-Z\-]+))+)')
|
||||
|
||||
FORMAL_TO_USUAL = {
|
||||
'ESP32': 'esp32',
|
||||
'ESP32-S2': 'esp32s2',
|
||||
'ESP32-S3': 'esp32s3',
|
||||
}
|
||||
|
||||
|
||||
class CMakeBuildSystem(BuildSystem):
|
||||
NAME = BUILD_SYSTEM_CMAKE
|
||||
@@ -95,33 +86,6 @@ class CMakeBuildSystem(BuildSystem):
|
||||
return False
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def supported_targets(app_path):
|
||||
formal_to_usual = {
|
||||
'ESP32': 'esp32',
|
||||
'ESP32-S2': 'esp32s2',
|
||||
'ESP32-S3': 'esp32s3',
|
||||
}
|
||||
|
||||
readme_file_content = BuildSystem._read_readme(app_path)
|
||||
if not readme_file_content:
|
||||
return None
|
||||
match = re.findall(BuildSystem.SUPPORTED_TARGETS_REGEX, readme_file_content)
|
||||
if not match:
|
||||
return None
|
||||
if len(match) > 1:
|
||||
raise NotImplementedError("Can't determine the value of SUPPORTED_TARGETS in {}".format(app_path))
|
||||
support_str = match[0].strip()
|
||||
|
||||
targets = []
|
||||
for part in support_str.split('|'):
|
||||
for inner in part.split(' '):
|
||||
inner = inner.strip()
|
||||
if not inner:
|
||||
continue
|
||||
elif inner in formal_to_usual:
|
||||
targets.append(formal_to_usual[inner])
|
||||
else:
|
||||
raise NotImplementedError("Can't recognize value of target {} in {}, now we only support '{}'"
|
||||
.format(inner, app_path, ', '.join(formal_to_usual.keys())))
|
||||
return targets
|
||||
@classmethod
|
||||
def supported_targets(cls, app_path):
|
||||
return cls._supported_targets(app_path)
|
||||
|
@@ -282,7 +282,7 @@ class BuildItem(object):
|
||||
size_info_fs.write(json.dumps(size_info_dict) + '\n')
|
||||
|
||||
|
||||
class BuildSystem(object):
|
||||
class BuildSystem:
|
||||
"""
|
||||
Class representing a build system.
|
||||
Derived classes implement the methods below.
|
||||
@@ -291,6 +291,12 @@ class BuildSystem(object):
|
||||
NAME = "undefined"
|
||||
SUPPORTED_TARGETS_REGEX = re.compile(r'Supported [Tt]argets((?:[\s|]+(?:ESP[0-9A-Z\-]+))+)')
|
||||
|
||||
FORMAL_TO_USUAL = {
|
||||
'ESP32': 'esp32',
|
||||
'ESP32-S2': 'esp32s2',
|
||||
'ESP32-S3': 'esp32s3',
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def build_prepare(cls, build_item):
|
||||
app_path = build_item.app_dir
|
||||
@@ -404,9 +410,34 @@ class BuildSystem(object):
|
||||
with open(readme_path, "r", encoding='utf8') as readme_file:
|
||||
return readme_file.read()
|
||||
|
||||
@staticmethod
|
||||
@classmethod
|
||||
def _supported_targets(cls, app_path):
|
||||
readme_file_content = BuildSystem._read_readme(app_path)
|
||||
if not readme_file_content:
|
||||
return cls.FORMAL_TO_USUAL.values() # supports all targets if no readme found
|
||||
match = re.findall(BuildSystem.SUPPORTED_TARGETS_REGEX, readme_file_content)
|
||||
if not match:
|
||||
return cls.FORMAL_TO_USUAL.values() # supports all targets if no such header in readme
|
||||
if len(match) > 1:
|
||||
raise NotImplementedError("Can't determine the value of SUPPORTED_TARGETS in {}".format(app_path))
|
||||
support_str = match[0].strip()
|
||||
|
||||
targets = []
|
||||
for part in support_str.split('|'):
|
||||
for inner in part.split(' '):
|
||||
inner = inner.strip()
|
||||
if not inner:
|
||||
continue
|
||||
elif inner in cls.FORMAL_TO_USUAL:
|
||||
targets.append(cls.FORMAL_TO_USUAL[inner])
|
||||
else:
|
||||
raise NotImplementedError("Can't recognize value of target {} in {}, now we only support '{}'"
|
||||
.format(inner, app_path, ', '.join(cls.FORMAL_TO_USUAL.keys())))
|
||||
return targets
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def supported_targets(app_path):
|
||||
def supported_targets(cls, app_path):
|
||||
pass
|
||||
|
||||
|
||||
|
@@ -61,6 +61,10 @@ class MakeBuildSystem(BuildSystem):
|
||||
return False
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def supported_targets(app_path):
|
||||
return ['esp32']
|
||||
@classmethod
|
||||
def supported_targets(cls, app_path):
|
||||
readme_supported_targets = cls._supported_targets(app_path)
|
||||
if readme_supported_targets and 'esp32' in readme_supported_targets:
|
||||
return ['esp32']
|
||||
else:
|
||||
return []
|
||||
|
Reference in New Issue
Block a user