Eric Roman | c6d0333 | 2018-04-23 20:52:18 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # Copyright 2018 The Chromium Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """The diagrams included in the network stack documentation were |
| 7 | generated with Graphviz, and both source (.dot) and output (.svg) are |
| 8 | included in the repository. If graphviz is installed, the output may |
| 9 | be regenerated by running this script.""" |
| 10 | |
| 11 | import glob |
| 12 | import os |
| 13 | import subprocess |
| 14 | |
| 15 | def main(): |
| 16 | for dot_filename in glob.glob("*.dot"): |
David Benjamin | 4aa6b2a | 2019-01-09 16:38:00 | [diff] [blame] | 17 | png_filename = os.path.splitext(dot_filename)[0] + ".png" |
| 18 | print "Generating %s from %s" % (png_filename, dot_filename) |
| 19 | subprocess.check_call(["dot", "-Tpng", dot_filename, "-o", png_filename]) |
| 20 | subprocess.check_call(["optipng", png_filename]) |
Eric Roman | c6d0333 | 2018-04-23 20:52:18 | [diff] [blame] | 21 | |
| 22 | |
| 23 | if __name__ == "__main__": |
| 24 | main() |