mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 10:13:34 +08:00
tools: pylint meson-render-jinja2.py
This commit is contained in:
parent
d853b9be98
commit
2d49429e58
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
# pylint: disable=consider-using-with
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
import os
|
import os
|
||||||
@ -30,7 +31,7 @@ def render(filename, defines):
|
|||||||
undefined=jinja2.StrictUndefined)
|
undefined=jinja2.StrictUndefined)
|
||||||
return template.render(defines)
|
return template.render(defines)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
defines = parse_config_h(sys.argv[1])
|
defines = parse_config_h(sys.argv[1])
|
||||||
defines.update(parse_config_h(sys.argv[2]))
|
defines.update(parse_config_h(sys.argv[2]))
|
||||||
output = render(sys.argv[3], defines)
|
output = render(sys.argv[3], defines)
|
||||||
@ -38,3 +39,6 @@ if __name__ == '__main__':
|
|||||||
f.write(output)
|
f.write(output)
|
||||||
info = os.stat(sys.argv[3])
|
info = os.stat(sys.argv[3])
|
||||||
os.chmod(sys.argv[4], info.st_mode)
|
os.chmod(sys.argv[4], info.st_mode)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user