1
0
mirror of https://github.com/esphome/esphome.git synced 2025-06-18 14:25:48 +01:00

proto generation updates ()

This commit is contained in:
Jesse Hills
2023-06-12 17:00:34 +12:00
committed by GitHub
parent 0a407c5425
commit f7c0ec6595
3 changed files with 37 additions and 0 deletions

@ -18,6 +18,7 @@ will be generated, they still need to be formatted
"""
import re
import os
from pathlib import Path
from textwrap import dedent
from subprocess import call
@ -944,3 +945,19 @@ with open(root / "api_pb2_service.cpp", "w") as f:
f.write(cpp)
prot.unlink()
try:
import clang_format
def exec_clang_format(path):
clang_format_path = os.path.join(
os.path.dirname(clang_format.__file__), "data", "bin", "clang-format"
)
call([clang_format_path, "-i", path])
exec_clang_format(root / "api_pb2_service.h")
exec_clang_format(root / "api_pb2_service.cpp")
exec_clang_format(root / "api_pb2.h")
exec_clang_format(root / "api_pb2.cpp")
except ImportError:
pass