apply to make build system

This commit is contained in:
Fu Hanxi
2020-06-19 18:58:03 +08:00
parent d7639d5cf8
commit 010d7e9023
6 changed files with 62 additions and 47 deletions

View File

@@ -341,34 +341,9 @@ class BuildSystem(object):
return readme_file.read()
@staticmethod
@abstractmethod
def supported_targets(app_path):
formal_to_usual = {
'ESP32': 'esp32',
'ESP32-S2': 'esp32s2',
}
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
pass
class BuildError(RuntimeError):