mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-28 06:24:10 +01:00
OP-910: fix line endings and whitespaces (didn't work on Linux)
This commit is contained in:
parent
6756f52044
commit
a7d1e2b298
9
ground/.gitattributes
vendored
9
ground/.gitattributes
vendored
@ -3,6 +3,9 @@
|
||||
# http://wiki.openpilot.org/display/Doc/Coding+Style
|
||||
#
|
||||
|
||||
*.pri text eol=crlf
|
||||
*.pro text eol=crlf
|
||||
|
||||
*.c text eol=crlf
|
||||
*.cpp text eol=crlf
|
||||
*.h text eol=crlf
|
||||
@ -13,9 +16,9 @@
|
||||
*.qml text eol=crlf
|
||||
*.pluginspec text eol=crlf
|
||||
|
||||
*.pri text eol=crlf
|
||||
*.pro text eol=crlf
|
||||
|
||||
*.h.template text eol=crlf
|
||||
*.c.template text eol=crlf
|
||||
*.cpp.template text eol=crlf
|
||||
*.qml.template text eol=crlf
|
||||
|
||||
*.py text eol=lf
|
||||
|
@ -1,52 +1,52 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Helper function to generate a QML list of contributors
|
||||
#
|
||||
# (c) 2013, The OpenPilot Team, http://www.openpilot.org
|
||||
# See also: The GNU Public License (GPL) Version 3
|
||||
#
|
||||
|
||||
import optparse
|
||||
import sys
|
||||
|
||||
def create_qml_file(args):
|
||||
"""This function reads input and template files and writes output QML file"""
|
||||
|
||||
assert args.infile is not None
|
||||
assert args.outfile is not None
|
||||
assert args.template is not None
|
||||
|
||||
with open(args.infile, "rt") as input_file:
|
||||
names = input_file.readlines()
|
||||
|
||||
names_list = ""
|
||||
for name in names:
|
||||
if name.strip():
|
||||
names_list += " ListElement { name: \"" + name.strip() + "\" }\n"
|
||||
|
||||
with open(args.template, "rt") as template_file, open(args.outfile, "wt") as output_file:
|
||||
template = template_file.read()
|
||||
output_file.write(template.replace("${LIST_ELEMENTS}\n", names_list))
|
||||
|
||||
return 0
|
||||
|
||||
def main():
|
||||
"""Helper function to generate a QML list of contributors"""
|
||||
|
||||
parser = optparse.OptionParser(description = main.__doc__);
|
||||
|
||||
parser.add_option('--infile', action='store',
|
||||
help='name of input file, one name per line');
|
||||
parser.add_option('--outfile', action='store',
|
||||
help='name of output QML file');
|
||||
parser.add_option('--template', action='store',
|
||||
help='name of QML template file');
|
||||
(args, positional_args) = parser.parse_args()
|
||||
|
||||
if (len(positional_args) != 0) or (len(sys.argv) == 1):
|
||||
parser.error("incorrect number of arguments, try --help for help")
|
||||
|
||||
return create_qml_file(args)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Helper function to generate a QML list of contributors
|
||||
#
|
||||
# (c) 2013, The OpenPilot Team, http://www.openpilot.org
|
||||
# See also: The GNU Public License (GPL) Version 3
|
||||
#
|
||||
|
||||
import optparse
|
||||
import sys
|
||||
|
||||
def create_qml_file(args):
|
||||
"""This function reads input and template files and writes output QML file"""
|
||||
|
||||
assert args.infile is not None
|
||||
assert args.outfile is not None
|
||||
assert args.template is not None
|
||||
|
||||
with open(args.infile, "rt") as input_file:
|
||||
names = input_file.readlines()
|
||||
|
||||
names_list = ""
|
||||
for name in names:
|
||||
if name.strip():
|
||||
names_list += " ListElement { name: \"" + name.strip() + "\" }\n"
|
||||
|
||||
with open(args.template, "rt") as template_file, open(args.outfile, "wt") as output_file:
|
||||
template = template_file.read()
|
||||
output_file.write(template.replace("${LIST_ELEMENTS}", names_list.rstrip()))
|
||||
|
||||
return 0
|
||||
|
||||
def main():
|
||||
"""Helper function to generate a QML list of contributors"""
|
||||
|
||||
parser = optparse.OptionParser(description = main.__doc__);
|
||||
|
||||
parser.add_option('--infile', action='store',
|
||||
help='name of input file, one name per line');
|
||||
parser.add_option('--outfile', action='store',
|
||||
help='name of output QML file');
|
||||
parser.add_option('--template', action='store',
|
||||
help='name of QML template file');
|
||||
(args, positional_args) = parser.parse_args()
|
||||
|
||||
if (len(positional_args) != 0) or (len(sys.argv) == 1):
|
||||
parser.error("incorrect number of arguments, try --help for help")
|
||||
|
||||
return create_qml_file(args)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
Loading…
Reference in New Issue
Block a user