Skip to content

Commit 646de64

Browse files
Augh, --unsafe-fixes got rid of my print statements! Dude!
1 parent 395b93e commit 646de64

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

tools/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies = [
3838

3939
# USB device detection on Linux
4040
"psutil; platform_system=='Linux'",
41-
"pyudev; platform_system=='Linux'",
41+
"pyudev>=0.24; platform_system=='Linux'", # 0.23.x seems to have issues with its Six dependency
4242

4343
# USB device detection on Mac
4444
"beautifulsoup4; sys_platform == 'darwin'",
@@ -78,7 +78,7 @@ linters = [
7878
"platformio",
7979
"SCons",
8080
"psutil",
81-
"pyudev",
81+
"pyudev>=0.24",
8282
"beautifulsoup4",
8383
"lxml"
8484
]

tools/python/mbed_platformio/build_mbed_ce.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,27 @@ def is_cmake_reconfigure_required() -> bool:
9696
ninja_buildfile = BUILD_DIR / "build.ninja"
9797

9898
if not cmake_cache_file.exists():
99+
print(f"Mbed CE: Reconfigure required because CMake cache does not exist")
99100
return True
100101
if not CMAKE_API_REPLY_DIR.is_dir() or not any(CMAKE_API_REPLY_DIR.iterdir()):
102+
print("Mbed CE: Reconfigure required because CMake API reply dir is missing")
101103
return True
102104
if not ninja_buildfile.exists():
105+
print("Mbed CE: Reconfigure required because Ninja buildfile does not exist")
103106
return True
104107

105108
# If the JSON files have 'Debug' in their names that means this project was previously configured as Debug.
106109
if not any(CMAKE_API_REPLY_DIR.glob(f"directory-*{CMAKE_BUILD_TYPE}*.json")):
110+
print("Mbed CE: Reconfigure required because build type (debug / release) changed.")
107111
return True
108112

109113
cache_file_mtime = cmake_cache_file.stat().st_mtime
110-
return any(file.stat().st_mtime > cache_file_mtime for file in cmake_config_files)
114+
for file in cmake_config_files:
115+
if file.stat().st_mtime > cache_file_mtime:
116+
print(f"Mbed CE: Reconfigure required because {file.name} was modified")
117+
return True
118+
119+
return False
111120

112121

113122
def run_tool(command_and_args: list[str] | None = None) -> None:
@@ -121,6 +130,8 @@ def run_tool(command_and_args: list[str] | None = None) -> None:
121130
env.Exit(1)
122131

123132
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
133+
print(result["out"])
134+
print(result["err"])
124135
pass
125136

126137

@@ -135,6 +146,7 @@ def get_cmake_code_model(cmake_args: list) -> dict:
135146
create_default_project_files()
136147

137148
if is_cmake_reconfigure_required():
149+
print("Mbed CE: Configuring CMake build system...")
138150
cmake_command = [str(CMAKE_PATH), *cmake_args]
139151
run_tool(cmake_command)
140152

@@ -254,6 +266,7 @@ def get_app_defines(app_config: dict) -> list[tuple[str, str]]:
254266
print("Error: Couldn't find code model generated by CMake", file=sys.stderr)
255267
env.Exit(1)
256268

269+
print("Mbed CE: Reading CMake configuration...")
257270
target_configs = load_target_configurations(project_codemodel)
258271

259272
framework_components_map = get_components_map(target_configs, ["STATIC_LIBRARY", "OBJECT_LIBRARY"], [])
@@ -300,6 +313,9 @@ def get_app_defines(app_config: dict) -> list[tuple[str, str]]:
300313
# Run Ninja to produce the linker script.
301314
# Note that this seems to execute CMake, causing the code model query to be re-done.
302315
# So, we have to do this after we are done using the results of said query.
316+
print("Mbed CE: Generating linker script...")
303317
project_ld_script = generate_project_ld_script()
304318
_ = env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", str(project_ld_script))
305319
env.Append(LDSCRIPT_PATH=str(project_ld_script))
320+
321+
print("Mbed CE: Build environment configured.")

tools/python/mbed_platformio/cmake_to_scons_converter.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def prepare_build_envs(target_json: dict, default_env: Environment) -> list[Envi
5353
build_envs = []
5454
target_compile_groups = target_json.get("compileGroups", [])
5555
if not target_compile_groups:
56-
pass
56+
print(
57+
"Warning! The `%s` component doesn't register any source files. "
58+
"Check if sources are set in component's CMakeLists.txt!" % target_json["name"]
59+
)
5760

5861
for cg in target_compile_groups:
5962
includes = []

tools/python/mbed_tools/build/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
"""
6-
Provides the core build system for Mbed OS, which relies on CMake and Ninja as underlying technologies.
6+
Provides the core Python parts of the build system for Mbed OS.
77
8-
The functionality covered in this package includes the following:
9-
10-
- Execution of Mbed Pre-Build stages to determine appropriate configuration for Mbed OS and the build process.
11-
- Invocation of the build process for the command line tools and online build service.
12-
- Export of build instructions to third party command line tools and IDEs.
8+
This module contains the configuration generation functionality, which processes JSON files into a set of target flags.
139
"""
1410

1511
from mbed_tools.build.config import generate_config as generate_config

0 commit comments

Comments
 (0)