mirror of
https://github.com/esphome/esphome.git
synced 2025-07-23 19:56:34 +00:00
Suppress spurious volatile and Python syntax warnings during builds (#9488)
This commit is contained in:
parent
873f4125c5
commit
e7d819a656
@ -78,6 +78,8 @@ def run_platformio_cli(*args, **kwargs) -> str | int:
|
|||||||
os.environ.setdefault(
|
os.environ.setdefault(
|
||||||
"PLATFORMIO_LIBDEPS_DIR", os.path.abspath(CORE.relative_piolibdeps_path())
|
"PLATFORMIO_LIBDEPS_DIR", os.path.abspath(CORE.relative_piolibdeps_path())
|
||||||
)
|
)
|
||||||
|
# Suppress Python syntax warnings from third-party scripts during compilation
|
||||||
|
os.environ.setdefault("PYTHONWARNINGS", "ignore::SyntaxWarning")
|
||||||
cmd = ["platformio"] + list(args)
|
cmd = ["platformio"] + list(args)
|
||||||
|
|
||||||
if not CORE.verbose:
|
if not CORE.verbose:
|
||||||
|
@ -162,6 +162,9 @@ def get_ini_content():
|
|||||||
# Sort to avoid changing build unflags order
|
# Sort to avoid changing build unflags order
|
||||||
CORE.add_platformio_option("build_unflags", sorted(CORE.build_unflags))
|
CORE.add_platformio_option("build_unflags", sorted(CORE.build_unflags))
|
||||||
|
|
||||||
|
# Add extra script for C++ flags
|
||||||
|
CORE.add_platformio_option("extra_scripts", ["pre:cxx_flags.py"])
|
||||||
|
|
||||||
content = "[platformio]\n"
|
content = "[platformio]\n"
|
||||||
content += f"description = ESPHome {__version__}\n"
|
content += f"description = ESPHome {__version__}\n"
|
||||||
|
|
||||||
@ -222,6 +225,9 @@ def write_platformio_project():
|
|||||||
write_gitignore()
|
write_gitignore()
|
||||||
write_platformio_ini(content)
|
write_platformio_ini(content)
|
||||||
|
|
||||||
|
# Write extra script for C++ specific flags
|
||||||
|
write_cxx_flags_script()
|
||||||
|
|
||||||
|
|
||||||
DEFINES_H_FORMAT = ESPHOME_H_FORMAT = """\
|
DEFINES_H_FORMAT = ESPHOME_H_FORMAT = """\
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -394,3 +400,16 @@ def write_gitignore():
|
|||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
with open(file=path, mode="w", encoding="utf-8") as f:
|
with open(file=path, mode="w", encoding="utf-8") as f:
|
||||||
f.write(GITIGNORE_CONTENT)
|
f.write(GITIGNORE_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
CXX_FLAGS_SCRIPT = """# Auto-generated ESPHome script for C++ specific compiler flags
|
||||||
|
Import("env")
|
||||||
|
|
||||||
|
# Add C++ specific warning flags
|
||||||
|
env.Append(CXXFLAGS=["-Wno-volatile"])
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def write_cxx_flags_script() -> None:
|
||||||
|
path = CORE.relative_build_path("cxx_flags.py")
|
||||||
|
write_file_if_changed(path, CXX_FLAGS_SCRIPT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user