Skip to content

Commit 38a4879

Browse files
authored
fix piohome hang
fix Pio home hang
2 parents ab9fc73 + da8c3c6 commit 38a4879

File tree

7 files changed

+42
-33
lines changed

7 files changed

+42
-33
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ test-driven methodologies, and modern toolchains for unrivaled success.
2222
6.1.19 (2025-??-??)
2323
~~~~~~~~~~~~~~~~~~~
2424

25+
* Fixed a regression issue where custom build flags were not properly reflected in the `compile_commands.json <https://docs.platformio.org/en/latest/integration/compile_commands.html>`__ file, ensuring accurate compilation database generation
26+
2527
6.1.18 (2025-03-11)
2628
~~~~~~~~~~~~~~~~~~~
2729

examples

platformio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
VERSION = (6, 1, 18)
15+
VERSION = (6, 1, 19)
1616
__version__ = ".".join([str(s) for s in VERSION])
1717

1818
__title__ = "platformio"

platformio/builder/tools/piobuild.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def GetBuildType(env):
5858

5959

6060
def BuildProgram(env):
61-
env.ProcessCompileDbToolchainOption()
6261
env.ProcessProgramDeps()
62+
env.ProcessCompileDbToolchainOption()
6363
env.ProcessProjectDeps()
6464

6565
# append into the beginning a main LD script
@@ -91,26 +91,6 @@ def BuildProgram(env):
9191
return program
9292

9393

94-
def ProcessCompileDbToolchainOption(env):
95-
if "compiledb" not in COMMAND_LINE_TARGETS:
96-
return
97-
# Resolve absolute path of toolchain
98-
for cmd in ("CC", "CXX", "AS"):
99-
if cmd not in env:
100-
continue
101-
if os.path.isabs(env[cmd]) or '"' in env[cmd]:
102-
continue
103-
env[cmd] = where_is_program(env.subst("$%s" % cmd), env.subst("${ENV['PATH']}"))
104-
if " " in env[cmd]: # issue #4998: Space in compilator path
105-
env[cmd] = f'"{env[cmd]}"'
106-
107-
if env.get("COMPILATIONDB_INCLUDE_TOOLCHAIN"):
108-
print("Warning! `COMPILATIONDB_INCLUDE_TOOLCHAIN` is scoping")
109-
for scope, includes in env.DumpIntegrationIncludes().items():
110-
if scope in ("toolchain",):
111-
env.Append(CPPPATH=includes)
112-
113-
11494
def ProcessProgramDeps(env):
11595
def _append_pio_macros():
11696
core_version = pepver_to_semver(__version__)
@@ -148,6 +128,27 @@ def _append_pio_macros():
148128
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
149129

150130

131+
def ProcessCompileDbToolchainOption(env):
132+
if "compiledb" not in COMMAND_LINE_TARGETS:
133+
return
134+
135+
# Resolve absolute path of toolchain
136+
for cmd in ("CC", "CXX", "AS"):
137+
if cmd not in env:
138+
continue
139+
if os.path.isabs(env[cmd]) or '"' in env[cmd]:
140+
continue
141+
env[cmd] = where_is_program(env.subst("$%s" % cmd), env.subst("${ENV['PATH']}"))
142+
if " " in env[cmd]: # issue #4998: Space in compilator path
143+
env[cmd] = f'"{env[cmd]}"'
144+
145+
if env.get("COMPILATIONDB_INCLUDE_TOOLCHAIN"):
146+
print("Warning! `COMPILATIONDB_INCLUDE_TOOLCHAIN` is scoping")
147+
for scope, includes in env.DumpIntegrationIncludes().items():
148+
if scope in ("toolchain",):
149+
env.Append(CPPPATH=includes)
150+
151+
151152
def ProcessProjectDeps(env):
152153
plb = env.ConfigureProjectLibBuilder()
153154

platformio/home/cli.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
1516
import mimetypes
1617
import socket
1718

1819
import click
1920

2021
from platformio.compat import IS_WINDOWS
2122
from platformio.home.run import run_server
22-
from platformio.package.manager.core import get_core_package_dir
23+
from platformio.project.config import ProjectConfig
2324

2425

25-
@click.command("home", short_help="GUI to manage PlatformIO")
26+
@click.command("home", short_help="GUI to manage PIO")
2627
@click.option("--port", type=int, default=8008, help="HTTP port, default=8008")
2728
@click.option(
2829
"--host",
@@ -53,7 +54,10 @@ def cli(port, host, no_open, shutdown_timeout, session_id):
5354
# hook for `platformio-node-helpers`
5455
if host == "__do_not_start__":
5556
# download all dependent packages
56-
get_core_package_dir("contrib-piohome")
57+
os.path.join(
58+
ProjectConfig.get_instance().get("platformio","packages_dir"),
59+
"contrib-piohome"
60+
)
5761
return
5862

5963
# Ensure PIO Home mimetypes are known
@@ -71,19 +75,19 @@ def cli(port, host, no_open, shutdown_timeout, session_id):
7175
[
7276
"",
7377
" ___I_",
74-
" /\\-_--\\ PlatformIO Home",
78+
" /\\-_--\\ PIO Home",
7579
"/ \\_-__\\",
7680
"|[]| [] | %s" % home_url,
7781
"|__|____|__%s" % ("_" * len(home_url)),
7882
]
7983
)
8084
)
8185
click.echo("")
82-
click.echo("Open PlatformIO Home in your browser by this URL => %s" % home_url)
86+
click.echo("Open PIO Home in your browser by this URL => %s" % home_url)
8387

8488
if is_port_used(host, port):
8589
click.secho(
86-
"PlatformIO Home server is already started in another process.", fg="yellow"
90+
"PIO Home server is already started in another process.", fg="yellow"
8791
)
8892
if not no_open:
8993
click.launch(home_url)

platformio/home/run.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from platformio.home.rpc.handlers.project import ProjectRPC
3737
from platformio.home.rpc.handlers.registry import RegistryRPC
3838
from platformio.home.rpc.server import WebSocketJSONRPCServerFactory
39-
from platformio.package.manager.core import get_core_package_dir
39+
from platformio.project.config import ProjectConfig
4040
from platformio.proc import force_exit
4141

4242

@@ -62,7 +62,8 @@ async def protected_page(_):
6262

6363

6464
def run_server(host, port, no_open, shutdown_timeout, home_url):
65-
contrib_dir = get_core_package_dir("contrib-piohome")
65+
packages_dir = ProjectConfig.get_instance().get("platformio", "packages_dir")
66+
contrib_dir = os.path.join(packages_dir, "contrib-piohome")
6667
if not os.path.isdir(contrib_dir):
6768
raise PlatformioException("Invalid path to PIO Home Contrib")
6869

platformio/remote/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
device_monitor_cmd,
3232
get_project_options,
3333
)
34-
from platformio.package.manager.core import get_core_package_dir
34+
from platformio.project.config import ProjectConfig
3535
from platformio.project.exception import NotPlatformIOProjectError
3636
from platformio.project.options import ProjectOptions
3737
from platformio.run.cli import cli as cmd_run
@@ -44,7 +44,8 @@
4444
def cli(ctx, agent):
4545
ctx.obj = agent
4646
# inject twisted dependencies
47-
contrib_dir = get_core_package_dir("contrib-pioremote")
47+
packages_dir = ProjectConfig.get_instance().get("platformio", "packages_dir")
48+
contrib_dir = os.path.join(packages_dir, "contrib-pioremote")
4849
if contrib_dir not in sys.path:
4950
addsitedir(contrib_dir)
5051
sys.path.insert(0, contrib_dir)

0 commit comments

Comments
 (0)