Makefile.am: Clean flake8-check too.
[cascardo/ovs.git] / ovsdb / ovsdb-doc
index 369efa9..5cf26ee 100755 (executable)
@@ -1,5 +1,19 @@
 #! /usr/bin/python
 
+# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 from datetime import date
 import getopt
 import os
@@ -15,9 +29,9 @@ from build.nroff import *
 argv0 = sys.argv[0]
 
 def typeAndConstraintsToNroff(column):
-    type = column.type.toEnglish(escapeNroffLiteral)
-    constraints = column.type.constraintsToEnglish(escapeNroffLiteral,
-                                                   textToNroff)
+    type = column.type.toEnglish(escape_nroff_literal)
+    constraints = column.type.constraintsToEnglish(escape_nroff_literal,
+                                                   text_to_nroff)
     if constraints:
         type += ", " + constraints
     if column.unique:
@@ -39,7 +53,7 @@ def columnGroupToNroff(table, groupXml, documented_columns):
             introNodes += [node]
 
     summary = []
-    intro = blockXmlToNroff(introNodes)
+    intro = block_xml_to_nroff(introNodes)
     body = ''
     for node in columnNodes:
         if node.tagName == 'column':
@@ -62,7 +76,7 @@ def columnGroupToNroff(table, groupXml, documented_columns):
 
                 if column.type.value:
                     typeNroff = "optional %s" % column.type.value.toEnglish(
-                        escapeNroffLiteral)
+                        escape_nroff_literal)
                     if (column.type.value.type == ovs.db.types.StringType and
                         type_.type == ovs.db.types.BooleanType):
                         # This is a little more explicit and helpful than
@@ -76,8 +90,8 @@ def columnGroupToNroff(table, groupXml, documented_columns):
                             else:
                                 typeNroff += ", containing a %s" % type_english
                         constraints = (
-                            type_.constraintsToEnglish(escapeNroffLiteral,
-                                                       textToNroff))
+                            type_.constraintsToEnglish(escape_nroff_literal,
+                                                       text_to_nroff))
                         if constraints:
                             typeNroff += ", %s" % constraints
                 else:
@@ -88,14 +102,14 @@ def columnGroupToNroff(table, groupXml, documented_columns):
             if not column.mutable:
                 typeNroff = "immutable %s" % typeNroff
             body += '.IP "\\fB%s\\fR: %s"\n' % (nameNroff, typeNroff)
-            body += blockXmlToNroff(node.childNodes, '.IP') + "\n"
+            body += block_xml_to_nroff(node.childNodes, '.IP') + "\n"
             summary += [('column', nameNroff, typeNroff)]
         elif node.tagName == 'group':
             title = node.attributes["title"].nodeValue
             subSummary, subIntro, subBody = columnGroupToNroff(
                 table, node, documented_columns)
             summary += [('group', title, subSummary)]
-            body += '.ST "%s:"\n' % textToNroff(title)
+            body += '.ST "%s:"\n' % text_to_nroff(title)
             body += subIntro + subBody
         else:
             raise error.Error("unknown element %s in <table>" % node.tagName)
@@ -172,7 +186,7 @@ def docsToNroff(schemaFile, xmlFile, erFile, version=None):
 .SH NAME
 %s \- %s database schema
 .PP
-''' % (manpage, schema.version, version, textToNroff(manpage), schema.name)
+''' % (manpage, schema.version, version, text_to_nroff(manpage), schema.name)
 
     tables = ""
     introNodes = []
@@ -198,7 +212,7 @@ def docsToNroff(schemaFile, xmlFile, erFile, version=None):
     for table in undocumented_tables:
         raise error.Error("undocumented table %s" % table)
 
-    s += blockXmlToNroff(introNodes) + "\n"
+    s += block_xml_to_nroff(introNodes) + "\n"
 
     s += r"""
 .SH "TABLE SUMMARY"
@@ -214,7 +228,7 @@ Purpose
 .TQ 1in
 \fB%s\fR
 %s
-""" % (name, textToNroff(title))
+""" % (name, text_to_nroff(title))
 
     if erFile:
         s += """