You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2016/06/29 19:45:31 UTC

qpid-dispatch git commit: NO-JIRA: Don't hide stderr in help2txt. [Forced Update!]

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 1786afeb6 -> 6464e0a2b (forced update)


NO-JIRA: Don't hide stderr in help2txt.

The help2txt tool was hiding stderr output, making it difficult to tell why it
failed if something went wrong.

Modified qdrouterd to print --help text to stdout not stderr.

BUILD_DOCS=off completely disables all doc generation, including help2txt


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/6464e0a2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/6464e0a2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/6464e0a2

Branch: refs/heads/master
Commit: 6464e0a2bcb6ba26d4995a1933bbd62c8e677380
Parents: 4797f4d
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Jun 29 15:35:47 2016 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Jun 29 15:44:28 2016 -0400

----------------------------------------------------------------------
 doc/CMakeLists.txt  | 110 +++++++++++++++++++++++------------------------
 doc/man/help2txt.py |  12 ++----
 router/src/main.c   |  18 ++++----
 3 files changed, 68 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6464e0a2/doc/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index d140021..f9a9468 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -21,61 +21,61 @@
 # if you don't want that. For new cmake it is only built by "make doc"
 option(BUILD_DOCS "Generate documentation with 'make doc'" ON)
 
-if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8")
-  # OPTIONAL does not exist in install before 2.8 so always make and install docs
-  set(DOC_TARGET ALL)
-  macro(install_doc)
-    install(${ARGN})
+if(BUILD_DOCS)
+  if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8")
+    # OPTIONAL does not exist in install before 2.8 so always make and install docs
+    set(DOC_TARGET ALL)
+    macro(install_doc)
+      install(${ARGN})
+    endmacro()
+  else()
+    macro(install_doc)
+      install(${ARGN} OPTIONAL)
+    endmacro()
+  endif()
+
+  # Popular locations
+  set(src ${CMAKE_CURRENT_SOURCE_DIR})
+  set(bin ${CMAKE_CURRENT_BINARY_DIR})
+  set(tools ${CMAKE_SOURCE_DIR}/tools)
+  set(schema ../python/qpid_dispatch/management/qdrouter.json)
+  set(py_management ../python/qpid_dispatch_internal/management)
+  set(schema_depends ${schema} ${py_management}/schema_doc.py ${py_management}/schema.py)
+
+  ## Always generate and install the asciidoc .adoc source files as a fallback.
+  ## They are readable even if we don't have the asciidoc tool to generate HTML.
+
+  # Generate asciidoc fragments from management schema to incorporate in text
+  macro(schema_gen script output)
+    add_custom_command(
+      OUTPUT ${output}
+      COMMAND ${RUN} -s ${script} 1> ${output}
+      DEPENDS ${script} ${schema_depends})
+    list(APPEND GENERATED_TXT "${output}")
   endmacro()
-else()
-  macro(install_doc)
-    install(${ARGN} OPTIONAL)
+
+  schema_gen(${src}/book/schema_txt.py ${bin}/schema.adoc)
+  schema_gen(${src}/man/qdrouterd.conf.5.py ${bin}/qdrouterd.conf.5.adoc)
+
+  # Generate asciidoc .adoc from --help output for man pages
+  macro(help2txt program)
+    get_filename_component(name ${program} NAME)
+    set(output ${bin}/${name}_help.adoc)
+    add_custom_command(
+      OUTPUT ${output}
+      COMMAND ${RUN} -s ${src}/man/help2txt.py ${program} --help 1> ${output}
+      DEPENDS ${program} ${schema_depends} ${src}/man/help2txt.py)
+    list(APPEND GENERATED_TXT "${output}")
   endmacro()
-endif()
-
-# Popular locations
-set(src ${CMAKE_CURRENT_SOURCE_DIR})
-set(bin ${CMAKE_CURRENT_BINARY_DIR})
-set(tools ${CMAKE_SOURCE_DIR}/tools)
-set(schema ../python/qpid_dispatch/management/qdrouter.json)
-set(py_management ../python/qpid_dispatch_internal/management)
-set(schema_depends ${schema} ${py_management}/schema_doc.py ${py_management}/schema.py)
-
-## Always generate and install the asciidoc .adoc source files as a fallback.
-## They are readable even if we don't have the asciidoc tool to generate HTML.
-
-# Generate asciidoc fragments from management schema to incorporate in text
-macro(schema_gen script output)
-  add_custom_command(
-    OUTPUT ${output}
-    COMMAND ${RUN} -s ${script} 1> ${output}
-    DEPENDS ${script} ${schema_depends})
-  list(APPEND GENERATED_TXT "${output}")
-endmacro()
-
-schema_gen(${src}/book/schema_txt.py ${bin}/schema.adoc)
-schema_gen(${src}/man/qdrouterd.conf.5.py ${bin}/qdrouterd.conf.5.adoc)
-
-# Generate asciidoc .adoc from --help output for man pages
-macro(help2txt program)
-  get_filename_component(name ${program} NAME)
-  set(output ${bin}/${name}_help.adoc)
-  add_custom_command(
-    OUTPUT ${output}
-    COMMAND ${RUN} -s ${src}/man/help2txt.py ${program} --help 1> ${output}
-    DEPENDS ${program} ${schema_depends} ${src}/man/help2txt.py)
-  list(APPEND GENERATED_TXT "${output}")
-endmacro()
-
-help2txt(${CMAKE_BINARY_DIR}/router/qdrouterd)
-help2txt(${tools}/qdmanage)
-help2txt(${tools}/qdstat)
-
-add_custom_target(doc_gen ALL DEPENDS ${GENERATED_TXT})
-install(DIRECTORY ${src}/book/ DESTINATION ${QD_DOC_INSTALL_DIR})
-install(FILES ${bin}/schema.adoc DESTINATION ${QD_DOC_INSTALL_DIR})
 
-if(BUILD_DOCS)
+  help2txt(${CMAKE_BINARY_DIR}/router/qdrouterd)
+  help2txt(${tools}/qdmanage)
+  help2txt(${tools}/qdstat)
+
+  add_custom_target(doc_gen ALL DEPENDS ${GENERATED_TXT})
+  install(DIRECTORY ${src}/book/ DESTINATION ${QD_DOC_INSTALL_DIR})
+  install(FILES ${bin}/schema.adoc DESTINATION ${QD_DOC_INSTALL_DIR})
+
   find_program(ASCIIDOC_EXE asciidoc DOC "Generate HTML documentation")
   if (ASCIIDOC_EXE)
     configure_file(${src}/asciidoc.conf.in ${bin}/asciidoc.conf)
@@ -126,13 +126,13 @@ if(BUILD_DOCS)
         list(APPEND DOC_DEPENDS ${bin}/book.pdf)
         install_doc(FILES ${bin}/book.pdf DESTINATION ${QD_DOC_INSTALL_DIR})
       else(DBLATEX_EXE)
-        message("Not generating PDF user guide: dblatex not found")
+        message(STATUS "dblatex not found: not generating PDF")
       endif(DBLATEX_EXE)
     else(A2X_EXE)
-      message("Not generating Unix Man pages or PDF user guide: a2x not found")
+      message(STATUS "a2x not found: not generating man pages or PDF")
     endif(A2X_EXE)
   else(ASCIIDOC_EXE)
-    message("No generated documentation: asciidoc not found")
+    message(STATUS "asciidoc not found: not generating HTML, man pages or PDF")
   endif(ASCIIDOC_EXE)
 
   add_custom_target(doc ${DOC_TARGET} DEPENDS ${DOC_DEPENDS})

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6464e0a2/doc/man/help2txt.py
----------------------------------------------------------------------
diff --git a/doc/man/help2txt.py b/doc/man/help2txt.py
index 3bf35d8..a1eca2c 100644
--- a/doc/man/help2txt.py
+++ b/doc/man/help2txt.py
@@ -20,7 +20,7 @@
 """
 Convert --help output of a program into asciidoc text format.
 """
-
+from __future__ import print_function
 import re, sys
 from qpid_dispatch_internal.compat.subproc import check_output, STDOUT, CalledProcessError
 from os import path
@@ -51,12 +51,8 @@ def help2txt(help_out):
 def main(argv):
     if len(argv) < 2: raise ValueError("Wrong number of arguments: "+usage)
     program = argv[1:]
-    print help2txt(check_output(program, stderr=STDOUT))
+    print(help2txt(check_output(program)))
 
 if __name__ == "__main__":
-    try:
-        main(sys.argv)
-    except CalledProcessError, e:
-        if hasattr(e, "output") and e.output:
-            print "\n%s\n\n%s\n" % (e, e.output)
-        raise
+    main(sys.argv)
+

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6464e0a2/router/src/main.c
----------------------------------------------------------------------
diff --git a/router/src/main.c b/router/src/main.c
index b121043..fa895d4 100644
--- a/router/src/main.c
+++ b/router/src/main.c
@@ -266,15 +266,15 @@ static void daemon_process(const char *config_path, const char *python_pkgdir,
 #define DEFAULT_DISPATCH_PYTHON_DIR QPID_DISPATCH_HOME_INSTALLED "/python"
 
 void usage(char **argv) {
-    fprintf(stderr, "Usage: %s [OPTIONS]\n\n", argv[0]);
-    fprintf(stderr, "  -c, --config=PATH (%s)\n", DEFAULT_CONFIG_PATH);
-    fprintf(stderr, "                             Load configuration from file at PATH\n");
-    fprintf(stderr, "  -I, --include=PATH (%s)\n", DEFAULT_DISPATCH_PYTHON_DIR);
-    fprintf(stderr, "                             Location of Dispatch's Python library\n");
-    fprintf(stderr, "  -d, --daemon               Run process as a SysV-style daemon\n");
-    fprintf(stderr, "  -P, --pidfile              If daemon, the file for the stored daemon pid\n");
-    fprintf(stderr, "  -U, --user                 If daemon, the username to run as\n");
-    fprintf(stderr, "  -h, --help                 Print this help\n");
+    fprintf(stdout, "Usage: %s [OPTIONS]\n\n", argv[0]);
+    fprintf(stdout, "  -c, --config=PATH (%s)\n", DEFAULT_CONFIG_PATH);
+    fprintf(stdout, "                             Load configuration from file at PATH\n");
+    fprintf(stdout, "  -I, --include=PATH (%s)\n", DEFAULT_DISPATCH_PYTHON_DIR);
+    fprintf(stdout, "                             Location of Dispatch's Python library\n");
+    fprintf(stdout, "  -d, --daemon               Run process as a SysV-style daemon\n");
+    fprintf(stdout, "  -P, --pidfile              If daemon, the file for the stored daemon pid\n");
+    fprintf(stdout, "  -U, --user                 If daemon, the username to run as\n");
+    fprintf(stdout, "  -h, --help                 Print this help\n");
 }
 
 int main(int argc, char **argv)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org