forked from Archive/PX4-Autopilot
[refactor][uorb-graph] add a pythonic __main__ idiom to the uorb-graph tool script
This commit is contained in:
parent
aef3c474e2
commit
8c87ef4272
|
@ -581,6 +581,7 @@ class OutputJSON(object):
|
|||
json.dump(data, outfile) # add indent=2 for readable formatting
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
|
||||
# ignore topics that are subscribed/published by many topics, but are not really
|
||||
# useful to show in the graph
|
||||
|
@ -595,14 +596,14 @@ else:
|
|||
graph = Graph(module_whitelist=module_whitelist, topic_blacklist=topic_blacklist)
|
||||
if len(args.src_path) == 0:
|
||||
args.src_path = ['src']
|
||||
graph.build(args.src_path, args.exclude_path, use_topic_pubsub_union=args.use_topic_union)
|
||||
|
||||
graph.build(args.src_path, args.exclude_path, use_topic_pubsub_union=args.use_topic_union)
|
||||
|
||||
if args.output == 'json':
|
||||
output_json = OutputJSON(graph)
|
||||
output_json.write(args.file+'.json')
|
||||
|
||||
elif args.output == 'graphviz':
|
||||
elif args.output in ('graphviz','gv'):
|
||||
try:
|
||||
from graphviz import Digraph
|
||||
except ImportError as e:
|
||||
|
|
Loading…
Reference in New Issue