mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-02-23 23:37:46 +00:00
Use generic 'dump_lines'
This commit is contained in:
parent
ff1bb76537
commit
7262333857
@ -3,6 +3,7 @@
|
|||||||
import re
|
import re
|
||||||
from fnvhash import fnv1a_32
|
from fnvhash import fnv1a_32
|
||||||
|
|
||||||
|
from qmk.commands import dump_lines
|
||||||
from qmk.git import git_get_version
|
from qmk.git import git_get_version
|
||||||
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
|
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
|
||||||
from qmk.xap.common import latest_xap_defs, route_conditions
|
from qmk.xap.common import latest_xap_defs, route_conditions
|
||||||
@ -119,18 +120,5 @@ def generate_header(output_file, keyboard):
|
|||||||
_append_route_capabilities(lines, xap_defs)
|
_append_route_capabilities(lines, xap_defs)
|
||||||
lines.append('')
|
lines.append('')
|
||||||
|
|
||||||
# Generate the full output
|
dump_lines(output_file, lines)
|
||||||
xap_generated_inl = '\n'.join(lines)
|
|
||||||
|
|
||||||
# Clean up newlines
|
|
||||||
while "\n\n\n" in xap_generated_inl:
|
|
||||||
xap_generated_inl = xap_generated_inl.replace("\n\n\n", "\n\n")
|
|
||||||
|
|
||||||
if output_file:
|
|
||||||
if output_file.name == '-':
|
|
||||||
print(xap_generated_inl)
|
|
||||||
else:
|
|
||||||
output_file.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
if output_file.exists():
|
|
||||||
output_file.replace(output_file.parent / (output_file.name + '.bak'))
|
|
||||||
output_file.write_text(xap_generated_inl)
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""This script generates the XAP protocol generated header to be compiled into QMK.
|
"""This script generates the XAP protocol generated header to be compiled into QMK.
|
||||||
"""
|
"""
|
||||||
from qmk.casing import to_snake
|
from qmk.casing import to_snake
|
||||||
|
from qmk.commands import dump_lines
|
||||||
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
|
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
|
||||||
from qmk.xap.common import latest_xap_defs, route_conditions
|
from qmk.xap.common import latest_xap_defs, route_conditions
|
||||||
|
|
||||||
@ -217,18 +218,4 @@ def generate_inline(output_file):
|
|||||||
# Add all the generated code
|
# Add all the generated code
|
||||||
_append_routing_tables(lines, xap_defs)
|
_append_routing_tables(lines, xap_defs)
|
||||||
|
|
||||||
# Generate the full output
|
dump_lines(output_file, lines)
|
||||||
xap_generated_inl = '\n'.join(lines)
|
|
||||||
|
|
||||||
# Clean up newlines
|
|
||||||
while "\n\n\n" in xap_generated_inl:
|
|
||||||
xap_generated_inl = xap_generated_inl.replace("\n\n\n", "\n\n")
|
|
||||||
|
|
||||||
if output_file:
|
|
||||||
if output_file.name == '-':
|
|
||||||
print(xap_generated_inl)
|
|
||||||
else:
|
|
||||||
output_file.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
if output_file.exists():
|
|
||||||
output_file.replace(output_file.parent / (output_file.name + '.bak'))
|
|
||||||
output_file.write_text(xap_generated_inl)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user