dev/gen: Add script to dump CMakeDeps in readable form
This commit is contained in:
1 parent
0c1698520b
commit
e79e557e88
1 file changed
+40
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
|
||||
def _exit(code=0, msg=None):
|
||||
if msg is not None:
|
||||
print(msg)
|
||||
exit(code)
|
||||
|
||||
|
||||
def _literal_linesep():
|
||||
ls = os.linesep
|
||||
if ls == '\r\n':
|
||||
return r'\r\n'
|
||||
if ls == '\n':
|
||||
return r'\n'
|
||||
return ls
|
||||
|
||||
|
||||
def _get_arg_parser():
|
||||
parser = argparse.ArgumentParser(description='Build spark_client.sln')
|
||||
parser.add_argument('input', nargs='?', help='The CMakeDeps file to dump')
|
||||
return parser
|
||||
|
||||
|
||||
def _main():
|
||||
parser = _get_arg_parser()
|
||||
args = parser.parse_args()
|
||||
cmd_args = ['sed', fr"'s/;/{_literal_linesep()}/g'", args.input]
|
||||
return subprocess.run(cmd_args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
res = _main()
|
||||
if res.returncode != 0:
|
||||
_exit(1, str(res))
|
||||
except Exception as e:
|
||||
_exit(1, str(e))
|
||||
Reference in new issue
Block a user