blob: 98ebea92ba27f23780319ff4513730fc3b9f2ec5 [file] [log] [blame]
#!/usr/bin/env python
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The diagrams included in the network stack documentation were
generated with Graphviz, and both source (.dot) and output (.svg) are
included in the repository. If graphviz is installed, the output may
be regenerated by running this script."""
import glob
import os
import subprocess
def main():
for dot_filename in glob.glob("*.dot"):
png_filename = os.path.splitext(dot_filename)[0] + ".png"
print "Generating %s from %s" % (png_filename, dot_filename)
subprocess.check_call(["dot", "-Tpng", dot_filename, "-o", png_filename])
subprocess.check_call(["optipng", png_filename])
if __name__ == "__main__":
main()