/usr/share/sumo/tools/turn-defs/generateTurnDefs.py is in sumo-tools 0.15.0~dfsg-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #!/usr/bin/python
# -*- encoding: utf8 -*-
""" Generates turn definitions XML file based on
connections XML file. """
import connections
import turndefinitions
import logging
import optparse
LOGGER = logging.getLogger(__name__)
if __name__ == "__main__":
# pylint: disable-msg=C0103
logging.basicConfig(level="INFO")
option_parser = optparse.OptionParser()
option_parser.add_option("-c", "--connections-file",
dest="connections_file",
help="Read connections defined in CONNECTIONS_FILE. Mandatory.",
metavar="CONNECTIONS_FILE")
option_parser.add_option("-t", "--turn-definitions-file",
dest="turn_definitions_file",
help="Write the resulting turn definitions to TURN_DEFINITIONS_FILE. "
"Mandatory.",
metavar="TURN_DEFINITIONS_FILE")
(options, args) = option_parser.parse_args()
if options.connections_file is None:
LOGGER.fatal("Missing CONNECTIONS_FILE.\n" +
option_parser.format_help())
exit()
if options.turn_definitions_file is None:
LOGGER.fatal("Missing TURN_DEFINITIONS_FILE.\n" +
option_parser.format_help())
exit()
connections_file = open(options.connections_file, "r")
turn_definitions_file = open(options.turn_definitions_file, "w")
connections = connections.from_stream(connections_file)
turn_definitions = turndefinitions.from_connections(connections)
turn_definitions_xml = turndefinitions.to_xml(turn_definitions)
turn_definitions_file.write(turn_definitions_xml)
connections_file.close()
turn_definitions_file.close()
|