mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 12:06:26 +01:00
proto generation updates (#4653)
This commit is contained in:
parent
0a407c5425
commit
f7c0ec6595
18
.vscode/tasks.json
vendored
18
.vscode/tasks.json
vendored
@ -36,6 +36,24 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Generate proto files",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${command:python.interpreterPath}",
|
||||||
|
"args": [
|
||||||
|
"./script/api_protobuf/api_protobuf.py"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "never",
|
||||||
|
"close": true,
|
||||||
|
"panel": "new"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -11,3 +11,5 @@ pytest-mock==3.10.0
|
|||||||
pytest-asyncio==0.21.0
|
pytest-asyncio==0.21.0
|
||||||
asyncmock==0.4.2
|
asyncmock==0.4.2
|
||||||
hypothesis==5.49.0
|
hypothesis==5.49.0
|
||||||
|
|
||||||
|
clang-format==13.0.1 ; platform_machine != 'armv7l'
|
||||||
|
@ -18,6 +18,7 @@ will be generated, they still need to be formatted
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
@ -944,3 +945,19 @@ with open(root / "api_pb2_service.cpp", "w") as f:
|
|||||||
f.write(cpp)
|
f.write(cpp)
|
||||||
|
|
||||||
prot.unlink()
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user