Author: aconway
Date: Wed Dec 10 06:04:01 2014
New Revision: 1644340

URL: http://svn.apache.org/r1644340
Log:
NO-JIRA: Fix to work with older help2man and cmake

Add --version option to tools, older help2man lacks --version-string
Add explicit paths in CMakeLists, older cmake doesn't default to BINARY/SOURCE 
directories.

"make check-man" is now an optional step, troublesome to automate as there
are spurious differences due to different versions of help2man etc.

Added:
    qpid/dispatch/trunk/python/qpid_dispatch_site.py.in
      - copied, changed from r1644326, 
qpid/dispatch/trunk/python/qpid_dispatch/site_data.py.in
Removed:
    qpid/dispatch/trunk/python/qpid_dispatch/qpid_dispatch/site_data.py
    qpid/dispatch/trunk/python/qpid_dispatch/site.py
    qpid/dispatch/trunk/python/qpid_dispatch/site_data.py.in
Modified:
    qpid/dispatch/trunk/doc/man/CMakeLists.txt
    qpid/dispatch/trunk/doc/man/README
    qpid/dispatch/trunk/doc/man/qdmanage.8.in
    qpid/dispatch/trunk/doc/man/qdstat.8.in
    qpid/dispatch/trunk/python/CMakeLists.txt
    qpid/dispatch/trunk/python/qpid_dispatch_internal/dispatch_c.py
    qpid/dispatch/trunk/python/qpid_dispatch_internal/tools/command.py
    qpid/dispatch/trunk/python/setup.py.in
    qpid/dispatch/trunk/tests/run.py.in
    qpid/dispatch/trunk/tools/qdmanage
    qpid/dispatch/trunk/tools/qdstat

Modified: qpid/dispatch/trunk/doc/man/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/doc/man/CMakeLists.txt?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/doc/man/CMakeLists.txt (original)
+++ qpid/dispatch/trunk/doc/man/CMakeLists.txt Wed Dec 10 06:04:01 2014
@@ -29,7 +29,7 @@ if(HELP2MAN)
     string(REGEX MATCH "[0-9]*$" section ${manpage})
     add_custom_command (
       OUTPUT ${manpage}
-      COMMAND ${RUN} -s ${src}/help2man.py ${HELP2MAN} --version-string 
${QPID_DISPATCH_VERSION} -s ${section} -i ${src}/${h2mfile} -N -o 
${bin}/${manpage} ${program}
+      COMMAND ${RUN} -s ${src}/help2man.py ${HELP2MAN} -s ${section} -i 
${src}/${h2mfile} -N -o ${bin}/${manpage} ${program}
       DEPENDS ${program} ${h2mfile}
       )
   endmacro()
@@ -39,7 +39,7 @@ else(HELP2MAN)
   message(WARNING "help2man is not avaliable, cannot update man pages")
   macro(help2man manpage h2mfile program)
     # Copy a pre-generated version of the man page.
-    configure_file(${manpage}.in ${manpage})
+    configure_file(${src}/${manpage}.in ${bin}/${manpage})
   endmacro()
 
 endif(HELP2MAN)
@@ -60,16 +60,12 @@ add_custom_command (OUTPUT ${QDROUTER_CO
     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/tests/run.py -s 
${src}/qdrouterd_conf_man.py ${QDROUTER_CONF_MAN}
     DEPENDS ${QDROUTER_CONF_MAN_DEPENDS})
 
-# Target to build the generated files by default
+# Target to build the generated files
 add_custom_target(man ALL DEPENDS ${QDROUTER_CONF_MAN} ${bin}/qdmanage.8 
${bin}/qdstat.8)
-
-# Target to check that checked-in versions of generated files are up to date.
-add_custom_target(check_man ALL DEPENDS man
-  COMMAND ${RUN} -s ${src}/check_help2man.py ${src} ${bin} qdmanage.8 qdstat.8)
-
+# Manual target to check if the generated files differ from the checked-in 
files
+add_custom_target(check-man COMMAND ${RUN} -s ${src}/check_help2man.py ${src} 
${bin} qdmanage.8 qdstat.8)
 
 # Install man pages
-
 install(FILES ${bin}/qdrouterd.8 DESTINATION ${MAN_INSTALL_DIR}/man8)
 install(FILES ${bin}/${QDROUTER_CONF_MAN} DESTINATION ${MAN_INSTALL_DIR}/man5)
 install(FILES ${bin}/qdstat.8 DESTINATION ${MAN_INSTALL_DIR}/man8)

Modified: qpid/dispatch/trunk/doc/man/README
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/doc/man/README?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/doc/man/README (original)
+++ qpid/dispatch/trunk/doc/man/README Wed Dec 10 06:04:01 2014
@@ -31,8 +31,10 @@ help2man will combine this with the --he
 See the help2man macro in CMakeLists.txt and the help2man documentation for 
more details.
 
 For building distributions when help2man is not available, the generated man 
page for
-each tool is checked in as "tool.8.in". When help2man is available, running 
make
-will warn if the checked in version is not  up to date with the generated 
version.
+each tool is checked in as "tool.8.in".
+
+Run "make check-man" to check if generated man pages are up to date with the
+checked-in versions.
 
 To update the man page you MUST use help2man, do not edit the checked in file
 as your edits will be lost.

Modified: qpid/dispatch/trunk/doc/man/qdmanage.8.in
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/doc/man/qdmanage.8.in?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/doc/man/qdmanage.8.in (original)
+++ qpid/dispatch/trunk/doc/man/qdmanage.8.in Wed Dec 10 06:04:01 2014
@@ -57,6 +57,9 @@ List all other known management nodes co
 \fB\-h\fR, \fB\-\-help\fR
 show this help message and exit
 .TP
+\fB\-\-version\fR
+Print version and exit
+.TP
 \fB\-\-type\fR=\fITYPE\fR
 Type of entity to operate on.
 .TP

Modified: qpid/dispatch/trunk/doc/man/qdstat.8.in
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/doc/man/qdstat.8.in?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/doc/man/qdstat.8.in (original)
+++ qpid/dispatch/trunk/doc/man/qdstat.8.in Wed Dec 10 06:04:01 2014
@@ -17,6 +17,9 @@ information.
 \fB\-h\fR, \fB\-\-help\fR
 show this help message and exit
 .TP
+\fB\-\-version\fR
+Print version and exit
+.TP
 \fB\-g\fR, \fB\-\-general\fR
 Show General Router Stats
 .TP

Modified: qpid/dispatch/trunk/python/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/CMakeLists.txt?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/CMakeLists.txt (original)
+++ qpid/dispatch/trunk/python/CMakeLists.txt Wed Dec 10 06:04:01 2014
@@ -23,8 +23,8 @@ install(DIRECTORY qpid_dispatch_internal
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in
                ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qpid_dispatch/site_data.py.in
-               ${CMAKE_CURRENT_BINARY_DIR}/qpid_dispatch/site_data.py)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qpid_dispatch_site.py.in
+               ${CMAKE_CURRENT_BINARY_DIR}/qpid_dispatch_site.py)
 
 # Install script for public python modules
 install(SCRIPT install_python.cmake)

Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/dispatch_c.py
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/dispatch_c.py?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/dispatch_c.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/dispatch_c.py Wed Dec 10 
06:04:01 2014
@@ -21,7 +21,7 @@
 
 import ctypes
 from ctypes import c_char_p, c_long, py_object
-from qpid_dispatch.site import QPID_DISPATCH_LIB
+import qpid_dispatch_site
 
 class CError(Exception):
     """Exception raised if there is an error in a C call"""
@@ -42,7 +42,7 @@ class QdDll(ctypes.PyDLL):
         return cls._instance
 
     def __init__(self):
-        lib = QPID_DISPATCH_LIB
+        lib = qpid_dispatch_site.LIB
         assert lib
         super(QdDll, self).__init__(lib)
 

Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/tools/command.py
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/tools/command.py?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/tools/command.py 
(original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/tools/command.py Wed Dec 
10 06:04:01 2014
@@ -23,6 +23,7 @@ Utilities for command-line programs.
 
 import os, sys, json, optparse
 from collections import Sequence, Mapping
+from qpid_dispatch_site import VERSION
 
 class UsageError(Exception):
     """
@@ -76,6 +77,7 @@ def connection_options(options, title="C
                      help="Client SSL private key (PEM Format)")
     return group
 
+
 class Option(optparse.Option):
     """Addes two new types to optparse.Option: json_map, json_list"""
 
@@ -92,3 +94,14 @@ class Option(optparse.Option):
 
     TYPES = optparse.Option.TYPES + ("json_list", "json_map")
     TYPE_CHECKER = dict(optparse.Option.TYPE_CHECKER, json_list=check_json, 
json_map=check_json)
+
+
+class OptionParser(optparse.OptionParser):
+    """Adds standard --version option to optparse.OptionParser"""
+    def __init__(self, *args, **kwargs):
+        optparse.OptionParser.__init__(self, *args, **kwargs)
+        def version_cb(*args):
+            print VERSION
+            exit(0)
+        self.add_option("--version", help="Print version and exit", 
action="callback", callback=version_cb)
+

Copied: qpid/dispatch/trunk/python/qpid_dispatch_site.py.in (from r1644326, 
qpid/dispatch/trunk/python/qpid_dispatch/site_data.py.in)
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_site.py.in?p2=qpid/dispatch/trunk/python/qpid_dispatch_site.py.in&p1=qpid/dispatch/trunk/python/qpid_dispatch/site_data.py.in&r1=1644326&r2=1644340&rev=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch/site_data.py.in (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_site.py.in Wed Dec 10 06:04:01 2014
@@ -14,18 +14,19 @@
 # "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.
+# under the License
 #
 
 """
-INTERNAL USE ONLY - Installed locations for qpid dispatch.
-
-Do not import directly, import site.py which also checks for override by
-environment variables. This file will not be available for uninstalled builds,
-site.py will use env variables instead.
+INTERNAL USE ONLY - Install locations and other site information for qpid 
dispatch.
 """
 
 from os.path import join
+from os import environ
+import sys
+
+HOME = environ.get("QPID_DISPATCH_HOME") or "${QPID_DISPATCH_HOME_INSTALLED}"
+LIB = environ.get("QPID_DISPATCH_LIB") or join("${CMAKE_INSTALL_PREFIX}", 
"${LIB_INSTALL_DIR}", "${QPID_DISPATCH_LIB}")
+VERSION = "${QPID_DISPATCH_VERSION}"
 
-QPID_DISPATCH_HOME = "${QPID_DISPATCH_HOME_INSTALLED}"
-QPID_DISPATCH_LIB = join("${CMAKE_INSTALL_PREFIX}", "${LIB_INSTALL_DIR}", 
"${QPID_DISPATCH_LIB}")
+sys.path.insert(0, join(HOME, 'python'))

Modified: qpid/dispatch/trunk/python/setup.py.in
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/setup.py.in?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/setup.py.in (original)
+++ qpid/dispatch/trunk/python/setup.py.in Wed Dec 10 06:04:01 2014
@@ -26,17 +26,17 @@ from os.path import join
 """Install public packages and scripts for Qpid Dispatch."""
 
 class BuildPy(build_py):
-    """Extend standard build command, add generated site_data.py file."""
+    """Extend standard build command, add generated modules from binary 
directory."""
 
-    SITE_DATA_PY = join('qpid_dispatch', 'site_data.py')
+    MODULES = ['qpid_dispatch_site.py']
 
     def run(self):
         build_py.run(self)      # Run the standard build, copies source .py 
files into builddir
-        copy_file(join('${CMAKE_CURRENT_BINARY_DIR}', self.SITE_DATA_PY),
-                  join(self.build_lib, self.SITE_DATA_PY))
+        for m in self.MODULES:
+            copy_file(join('${CMAKE_CURRENT_BINARY_DIR}', m), 
join(self.build_lib, m))
 
     def get_outputs(self, **kwargs):
-        return build_py.get_outputs(self, **kwargs) +[join(self.build_lib, 
self.SITE_DATA_PY)]
+        return build_py.get_outputs(self, **kwargs) + [join(self.build_lib, m) 
for m in self.MODULES]
 
 # Install public python modules in standard python locations.
 setup(

Modified: qpid/dispatch/trunk/tests/run.py.in
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/run.py.in?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/run.py.in (original)
+++ qpid/dispatch/trunk/tests/run.py.in Wed Dec 10 06:04:01 2014
@@ -49,6 +49,7 @@ def dedup(l):
 
 sys.path = dedup([
     "${CMAKE_SOURCE_DIR}/python",
+    "${CMAKE_BINARY_DIR}/python",
     "${CMAKE_SOURCE_DIR}/tests"
 ] + sys.path)
 

Modified: qpid/dispatch/trunk/tools/qdmanage
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/tools/qdmanage?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/tools/qdmanage (original)
+++ qpid/dispatch/trunk/tools/qdmanage Wed Dec 10 06:04:01 2014
@@ -20,11 +20,11 @@
 #
 
 import sys, json
-import  qpid_dispatch.site
+import  qpid_dispatch_site
 from qpid_dispatch.management import Node, Url
 from collections import Mapping, Sequence
-from optparse import OptionParser, OptionGroup
-from qpid_dispatch_internal.tools.command import Option, UsageError, 
connection_options, check_args, main
+from optparse import OptionGroup
+from qpid_dispatch_internal.tools.command import OptionParser, Option, 
UsageError, connection_options, check_args, main
 
 class QdManage():
 

Modified: qpid/dispatch/trunk/tools/qdstat
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/tools/qdstat?rev=1644340&r1=1644339&r2=1644340&view=diff
==============================================================================
--- qpid/dispatch/trunk/tools/qdstat (original)
+++ qpid/dispatch/trunk/tools/qdstat Wed Dec 10 06:04:01 2014
@@ -20,17 +20,17 @@
 #
 
 import os
-from optparse import OptionParser, OptionGroup
+from optparse import OptionGroup
 import sys
 import locale
 import socket
 import re
 from proton import Messenger, Message, Timeout
-import  qpid_dispatch.site
+import  qpid_dispatch_site
 from qpid_dispatch.management import Url, Node, Entity
 from qpid_dispatch_internal.management.qdrouter import QdSchema
 from qpid_dispatch_internal.tools import Display, Header, Sorter, YN, Commas, 
TimeLong
-from qpid_dispatch_internal.tools.command import connection_options, main
+from qpid_dispatch_internal.tools.command import connection_options, main, 
OptionParser
 
 
 class Config:



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to