mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
style: format python files with isort and double-quote-string-fixer
This commit is contained in:
@@ -4,14 +4,14 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from .common import BuildSystem, BuildItem, BuildError
|
||||
from .common import BuildError, BuildItem, BuildSystem
|
||||
|
||||
BUILD_SYSTEM_CMAKE = "cmake"
|
||||
IDF_PY = os.path.join(os.environ["IDF_PATH"], "tools", "idf.py")
|
||||
BUILD_SYSTEM_CMAKE = 'cmake'
|
||||
IDF_PY = os.path.join(os.environ['IDF_PATH'], 'tools', 'idf.py')
|
||||
|
||||
# While ESP-IDF component CMakeLists files can be identified by the presence of 'idf_component_register' string,
|
||||
# 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)"
|
||||
CMAKE_PROJECT_LINE = r'include($ENV{IDF_PATH}/tools/cmake/project.cmake)'
|
||||
|
||||
|
||||
class CMakeBuildSystem(BuildSystem):
|
||||
@@ -24,23 +24,23 @@ class CMakeBuildSystem(BuildSystem):
|
||||
args = [
|
||||
sys.executable,
|
||||
IDF_PY,
|
||||
"-B",
|
||||
'-B',
|
||||
build_path,
|
||||
"-C",
|
||||
'-C',
|
||||
work_path,
|
||||
"-DIDF_TARGET=" + build_item.target,
|
||||
'-DIDF_TARGET=' + build_item.target,
|
||||
]
|
||||
if extra_cmakecache_items:
|
||||
for key, val in extra_cmakecache_items.items():
|
||||
args.append("-D{}={}".format(key, val))
|
||||
if "TEST_EXCLUDE_COMPONENTS" in extra_cmakecache_items \
|
||||
and "TEST_COMPONENTS" not in extra_cmakecache_items:
|
||||
args.append("-DTESTS_ALL=1")
|
||||
args.append('-D{}={}'.format(key, val))
|
||||
if 'TEST_EXCLUDE_COMPONENTS' in extra_cmakecache_items \
|
||||
and 'TEST_COMPONENTS' not in extra_cmakecache_items:
|
||||
args.append('-DTESTS_ALL=1')
|
||||
if build_item.verbose:
|
||||
args.append("-v")
|
||||
args.append("build")
|
||||
cmdline = format(" ".join(args))
|
||||
logging.info("Running {}".format(cmdline))
|
||||
args.append('-v')
|
||||
args.append('build')
|
||||
cmdline = format(' '.join(args))
|
||||
logging.info('Running {}'.format(cmdline))
|
||||
|
||||
if build_item.dry_run:
|
||||
return
|
||||
@@ -49,20 +49,20 @@ class CMakeBuildSystem(BuildSystem):
|
||||
build_stdout = sys.stdout
|
||||
build_stderr = sys.stderr
|
||||
if build_item.build_log_path:
|
||||
logging.info("Writing build log to {}".format(build_item.build_log_path))
|
||||
log_file = open(build_item.build_log_path, "w")
|
||||
logging.info('Writing build log to {}'.format(build_item.build_log_path))
|
||||
log_file = open(build_item.build_log_path, 'w')
|
||||
build_stdout = log_file
|
||||
build_stderr = log_file
|
||||
|
||||
try:
|
||||
subprocess.check_call(args, stdout=build_stdout, stderr=build_stderr)
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise BuildError("Build failed with exit code {}".format(e.returncode))
|
||||
raise BuildError('Build failed with exit code {}'.format(e.returncode))
|
||||
else:
|
||||
# Also save the sdkconfig file in the build directory
|
||||
shutil.copyfile(
|
||||
os.path.join(work_path, "sdkconfig"),
|
||||
os.path.join(build_path, "sdkconfig"),
|
||||
os.path.join(work_path, 'sdkconfig'),
|
||||
os.path.join(build_path, 'sdkconfig'),
|
||||
)
|
||||
build_item.size_json_fp = build_item.get_size_json_fp()
|
||||
finally:
|
||||
@@ -71,10 +71,10 @@ class CMakeBuildSystem(BuildSystem):
|
||||
|
||||
@staticmethod
|
||||
def _read_cmakelists(app_path):
|
||||
cmakelists_path = os.path.join(app_path, "CMakeLists.txt")
|
||||
cmakelists_path = os.path.join(app_path, 'CMakeLists.txt')
|
||||
if not os.path.exists(cmakelists_path):
|
||||
return None
|
||||
with open(cmakelists_path, "r") as cmakelists_file:
|
||||
with open(cmakelists_path, 'r') as cmakelists_file:
|
||||
return cmakelists_file.read()
|
||||
|
||||
@staticmethod
|
||||
|
Reference in New Issue
Block a user