]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3516] get rid of root (vs file list) and boost libs
authorFrancis Dupont <fdupont@isc.org>
Sat, 28 Feb 2015 00:05:45 +0000 (01:05 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sat, 28 Feb 2015 00:05:45 +0000 (01:05 +0100)
doc/guide/Makefile.am
tools/system_messages.cc
tools/system_messages.py

index ffda1d52450c8041095c35b6b22d19e48bdc4333..20e5bdfdd8fe68a077a0eed39fc3eb20e4e15558 100644 (file)
@@ -13,7 +13,8 @@ EXTRA_DIST = $(DOCBOOK)
 DISTCLEANFILES = $(HTMLDOCS) $(DOCS) kea-messages.xml
 
 kea-messages.xml:
-       $(PYTHON) $(top_srcdir)/tools/system_messages.py -o $@ $(top_srcdir)
+       $(PYTHON) $(top_srcdir)/tools/system_messages.py -o $@ \
+       `find $(top_srcdir) -name "*.mes" -print`
 
 # This is not a "man" manual, but reuse this for now for docbook.
 if GENERATE_DOCS
@@ -35,6 +36,7 @@ kea-messages.html: kea-messages.xml
        @XSLTPROC@ --novalid --xinclude --nonet \
                --path $(top_builddir)/doc \
                -o $@ \
+               --stringparam generate.toc "book toc" \
                --stringparam html.stylesheet kea-guide.css \
                http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl \
                kea-messages.xml
index 3eccb7de24d80d856f2bf58642204504603bb583..bb708486b0ee6c1269a990cc612c06fada6a8246 100644 (file)
 
 // Produce System Messages Manual
 //
-// This tool reads all the .mes files in the directory tree whose root is given
-// on the command line and interprets them as message files.  It pulls
-// all the messages and description out, sorts them by message ID, and writes
-// them out as a single (formatted) file.
+// This tool reads all the message files given on the command line.
+// It pulls all the messages and description out, sorts them by
+// message ID, and writes them out as a single (formatted) file.
 //
 // Invocation:
 // The code is invoked using the command line:
 //
-// kt_system_messages.py [-o <output-file>] [<top-source-directory>|<files>]
+// system_messages [-o <output-file>] <files>
 //
 // If no output file is specified, output is written to stdout.
 
@@ -36,7 +35,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef USE_BOOST_FILESYSTEM
 #include <boost/filesystem.hpp>
+#endif
 #include <boost/lexical_cast.hpp>
 
 typedef std::vector<std::string> lines_type;
@@ -522,6 +523,7 @@ void processFile(const std::string& filename)
 ///
 /// Parameters:
 ///  root     Directory that is the root of the source tree
+#ifdef USE_BOOST_FILESYSTEM
 void processAllFiles(const boost::filesystem::path& root)
 {
     boost::filesystem::directory_iterator endd;
@@ -540,12 +542,17 @@ void processAllFiles(const boost::filesystem::path& root)
         }
     }
 }
-
+#endif
 
 void usage(char* progname)
 {
+#ifdef USE_BOOST_FILESYSTEM
+    std::cerr << "Usage: " << progname <<
+        " [--help | options] root|files\n";
+#else
     std::cerr << "Usage: " << progname <<
-        " [--help | options] [root|files]\n";
+        " [--help | options] files\n";
+#endif
     std::cerr << " options: --output file: " <<
         "output file name (default to stdout)\n";
 }
@@ -581,6 +588,7 @@ int main(int argc, char* argv[])
         usage(progname);
         exit(-1);
     }
+#ifdef USE_BOOST_FILESYSTEM
     if (argc > 1) {
         for (int i = 0; i < argc; ++i) {
             processFile(argv[i]);
@@ -593,6 +601,11 @@ int main(int argc, char* argv[])
             processFile(argv[0]);
         }
     }
+#else
+    for (int i = 0; i < argc; ++i) {
+        processFile(argv[i]);
+    }
+#endif
 
     // Now just print out everything we've read (in alphabetical order).
     bool first = true;
index a682429d915f9a18d089275075319e411b0048d5..20190c79d9bee18bd1b27b357b58ba5949b7b7a5 100644 (file)
@@ -22,7 +22,7 @@
 # Invocation:
 # The code is invoked using the command line:
 #
-# python system_messages.py [-o <output-file>] <top-source-directory>
+# python system_messages.py [-o <output-file>] <top-source-directory>|<files>
 #
 # If no output file is specified, output is written to stdout.
 
@@ -402,23 +402,25 @@ def processAllFiles(root):
 
 # Main program
 if __name__ == "__main__":
-    parser = OptionParser(usage="Usage: %prog [--help | options] root")
+    parser = OptionParser(usage="Usage: %prog [--help | options] root|files")
     parser.add_option("-o", "--output", dest="output", default=None,
                       metavar="FILE", 
                       help="output file name (default to stdout)")
     (options, args) = parser.parse_args()
 
     if len(args) == 0:
-        parser.error("Must supply directory at which to begin search")
-    elif len(args) > 1:
-        parser.error("Only a single root directory can be given")
+        parser.error("Must supply directory at which to begin search or files")
 
     # Redirect output if specified (errors are written to stderr)
     if options.output is not None:
         sys.stdout = open(options.output, 'w')
 
     # Read the files and load the data
-    processAllFiles(args[0])
+    if (len(args) > 1) or (not os.path.isdir(args[0])):
+        for file in args:
+            processFile(file)
+    else:
+        processAllFiles(args[0])
 
     # Now just print out everything we've read (in alphabetical order).
     sname = ""