qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1545678 - in /qpid/dispatch/trunk: ./ include/qpid/dispatch/ python/qpid_dispatch/ python/qpid_dispatch_internal/ router/ router/src/ src/ tests/ tools/
Date Tue, 26 Nov 2013 14:58:10 GMT
Author: tross
Date: Tue Nov 26 14:58:09 2013
New Revision: 1545678

URL: http://svn.apache.org/r1545678
Log:
QPID-5335 - Moved python components to a private install location.
- Applied patch provided by Darryl Pierce.

Added:
    qpid/dispatch/trunk/python/qpid_dispatch_internal/
      - copied from r1544173, qpid/dispatch/trunk/python/qpid_dispatch/
    qpid/dispatch/trunk/tools/qdstat.in
      - copied, changed from r1544173, qpid/dispatch/trunk/tools/qdstat
Removed:
    qpid/dispatch/trunk/python/qpid_dispatch/
    qpid/dispatch/trunk/tools/qdstat
Modified:
    qpid/dispatch/trunk/CMakeLists.txt
    qpid/dispatch/trunk/ChangeLog
    qpid/dispatch/trunk/config.sh
    qpid/dispatch/trunk/include/qpid/dispatch/dispatch.h
    qpid/dispatch/trunk/include/qpid/dispatch/python_embedded.h
    qpid/dispatch/trunk/router/CMakeLists.txt
    qpid/dispatch/trunk/router/src/config.h.in
    qpid/dispatch/trunk/router/src/main.c
    qpid/dispatch/trunk/src/config.c
    qpid/dispatch/trunk/src/dispatch.c
    qpid/dispatch/trunk/src/python_embedded.c
    qpid/dispatch/trunk/src/router_pynode.c
    qpid/dispatch/trunk/tests/router_engine_test.py
    qpid/dispatch/trunk/tests/server_test.c

Modified: qpid/dispatch/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/CMakeLists.txt?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/CMakeLists.txt (original)
+++ qpid/dispatch/trunk/CMakeLists.txt Tue Nov 26 14:58:09 2013
@@ -48,19 +48,13 @@ if (NOT DEFINED LIB_SUFFIX)
 endif()
 
 set(INCLUDE_INSTALL_DIR include CACHE PATH "Include file directory")
+set(QPID_DISPATCH_HOME "lib/qpid-dispatch" CACHE PATH "Private Dispatch library directory")
 set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Library object file directory")
 set(SYSCONF_INSTALL_DIR etc CACHE PATH "System read only configuration directory")
 set(SHARE_INSTALL_DIR share CACHE PATH "Shared read only data directory")
 set(DOC_INSTALL_DIR ${SHARE_INSTALL_DIR}/doc CACHE PATH "Shared read-only data directory")
 set(MAN_INSTALL_DIR share/man CACHE PATH "Manpage directory")
-
-# determine the location for installing the python packages
-if (PYTHONLIBS_FOUND)
-    execute_process(COMMAND ${PYTHON_EXECUTABLE}
-                    -c "from distutils.sysconfig import get_python_lib; print get_python_lib(False,
False, \"${CMAKE_INSTALL_PREFIX}\")"
-                    OUTPUT_VARIABLE PYTHON_SITELIB_PACKAGES
-                    OUTPUT_STRIP_TRAILING_WHITESPACE)
-endif (PYTHONLIBS_FOUND)
+set(QPID_DISPATCH_HOME_INSTALLED ${CMAKE_INSTALL_PREFIX}/${QPID_DISPATCH_HOME})
 
 ##
 ## Find dependencies
@@ -86,7 +80,11 @@ set (CMAKE_REQUIRED_INCLUDES ${proton_in
 set (CMAKE_REQUIRED_LIBRARIES ${proton_lib})
 check_function_exists(pn_link_get_drain HAVE_LINK_GET_DRAIN)
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/conditionals.h.in ${CMAKE_CURRENT_BINARY_DIR}/conditionals.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/conditionals.h.in
+               ${CMAKE_CURRENT_BINARY_DIR}/conditionals.h)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/qdstat.in
+               ${CMAKE_CURRENT_BINARY_DIR}/tools/qdstat)
 
 ##
 ## Build the Multi-Threaded Server Library
@@ -138,39 +136,8 @@ install(FILES etc/qdrouterd.conf DESTINA
 ##
 ## Python modules installation
 ##
-set(PYTHON_STUBS_SOURCES
-    python/qpid_dispatch/stubs/__init__.py
-    python/qpid_dispatch/stubs/ioadapter.py
-    python/qpid_dispatch/stubs/logadapter.py
-)
-
-set(PYTHON_ROUTER_SOURCES
-    python/qpid_dispatch/router/link.py
-    python/qpid_dispatch/router/engine.py
-    python/qpid_dispatch/router/__init__.py
-    python/qpid_dispatch/router/mobile.py
-    python/qpid_dispatch/router/node.py
-    python/qpid_dispatch/router/routing.py
-    python/qpid_dispatch/router/data.py
-    python/qpid_dispatch/router/configuration.py
-    python/qpid_dispatch/router/neighbor.py
-    python/qpid_dispatch/router/path.py
-)
-
-set(PYTHON_CONFIG_SOURCES
-    python/qpid_dispatch/config/parser.py
-    python/qpid_dispatch/config/__init__.py
-    python/qpid_dispatch/config/schema.py
-    python/qpid_dispatch/__init__.py
-)
-
-set(PYTHON_TOOLS_SOURCES
-    python/qpid_dispatch/tools/__init__.py
-    python/qpid_dispatch/tools/display.py
-)
-
 set(PYTHON_TOOLS_EXECUTABLES
-    tools/qdstat
+    ${CMAKE_CURRENT_BINARY_DIR}/tools/qdstat
 )
 
 set(DOC_FILES
@@ -180,29 +147,15 @@ set(DOC_FILES
     TODO
 )
 
-install(FILES ${PYTHON_STUBS_SOURCES}
-        DESTINATION ${PYTHON_SITELIB_PACKAGES}/qpid_dispatch/stubs)
-
-install(FILES ${PYTHON_ROUTER_SOURCES}
-        DESTINATION ${PYTHON_SITELIB_PACKAGES}/qpid_dispatch/router)
-
-install(FILES ${PYTHON_CONFIG_SOURCES}
-        DESTINATION ${PYTHON_SITELIB_PACKAGES}/qpid_dispatch/config)
-
-install(FILES ${PYTHON_TOOLS_SOURCES}
-        DESTINATION ${PYTHON_SITELIB_PACKAGES}/qpid_dispatch/tools)
-
-install(FILES python/qpid_dispatch/__init__.py
-        DESTINATION ${PYTHON_SITELIB_PACKAGES}/qpid_dispatch)
-
-install(FILES python/qpid_dispatch/__init__.py
-        DESTINATION ${PYTHON_SITELIB_PACKAGES}/qpid_dispatch)
+install(DIRECTORY python/qpid_dispatch_internal
+        DESTINATION ${QPID_DISPATCH_HOME}/python)
 
 install(PROGRAMS ${PYTHON_TOOLS_EXECUTABLES}
         DESTINATION bin)
 
 install(FILES ${DOC_FILES}
         DESTINATION ${DOC_INSTALL_DIR}/qpid-dispatch)
+
 ##
 ## Build Tests
 ##

Modified: qpid/dispatch/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/ChangeLog?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/ChangeLog (original)
+++ qpid/dispatch/trunk/ChangeLog Tue Nov 26 14:58:09 2013
@@ -25,3 +25,4 @@ Version 0.1:
 	* QPID-5201: Dispatch - Fix build errors in Release mode
 	* QPID-5218: [dispatch] Crash when outgoing window > 0 and multiple subscribed Messenger
clients
 	* QPID-5338: The Dispatch top-level Python package should be renamed
+	* QPID-5335: Dispatch Python libraries need to install to a private directory.

Modified: qpid/dispatch/trunk/config.sh
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/config.sh?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/config.sh (original)
+++ qpid/dispatch/trunk/config.sh Tue Nov 26 14:58:09 2013
@@ -23,5 +23,5 @@ export QPID_DISPATCH_HOME=$(pwd)
 cd - > /dev/null
 
 export PYTHONPATH=$QPID_DISPATCH_HOME/python:$PYTHONPATH
-export PATH=$QPID_DISPATCH_HOME/tools:$PATH
+export PATH=$QPID_DISPATCH_HOME/build/tools:$PATH
 

Modified: qpid/dispatch/trunk/include/qpid/dispatch/dispatch.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/include/qpid/dispatch/dispatch.h?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/include/qpid/dispatch/dispatch.h (original)
+++ qpid/dispatch/trunk/include/qpid/dispatch/dispatch.h Tue Nov 26 14:58:09 2013
@@ -29,10 +29,12 @@ typedef struct qd_dispatch_t qd_dispatch
 /**
  * \brief Initialize the Dispatch library and prepare it for operation.
  *
- * #param config_path The path to the configuration file.
+ * @param config_path The path to the configuration file.
+ * @param python_pkgdir The path to the Python files.
  * @return A handle to be used in API calls for this instance.
  */
-qd_dispatch_t *qd_dispatch(const char *config_path);
+qd_dispatch_t *qd_dispatch(const char *config_path,
+                           const char *python_pkgdir);
 
 
 /**

Modified: qpid/dispatch/trunk/include/qpid/dispatch/python_embedded.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/include/qpid/dispatch/python_embedded.h?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/include/qpid/dispatch/python_embedded.h (original)
+++ qpid/dispatch/trunk/include/qpid/dispatch/python_embedded.h Tue Nov 26 14:58:09 2013
@@ -29,7 +29,8 @@
  * Initialize the embedded-python subsystem.  This must be called before
  * any other call into this module is invoked.
  */
-void qd_python_initialize(qd_dispatch_t *qd);
+void qd_python_initialize(qd_dispatch_t *qd,
+                          const char    *python_pkgdir);
 
 /**
  * Finalize the embedded-python subsystem.  After this is called, there

Modified: qpid/dispatch/trunk/router/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/router/CMakeLists.txt?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/router/CMakeLists.txt (original)
+++ qpid/dispatch/trunk/router/CMakeLists.txt Tue Nov 26 14:58:09 2013
@@ -19,7 +19,7 @@
 
 
 set(DEFAULT_CONFIG_PATH "/etc/qpid-dispatch/qdrouterd.conf" CACHE string "Default config
file path")
-
+set(DEFAULT_DISPATCH_PYTHON_DIR ${QPID_DISPATCH_PYTHON_DIR})
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR})

Modified: qpid/dispatch/trunk/router/src/config.h.in
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/router/src/config.h.in?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/router/src/config.h.in (original)
+++ qpid/dispatch/trunk/router/src/config.h.in Tue Nov 26 14:58:09 2013
@@ -17,5 +17,5 @@
  * under the License.
  */
 
-#cmakedefine DEFAULT_CONFIG_PATH "${DEFAULT_CONFIG_PATH}"
-
+#cmakedefine DEFAULT_CONFIG_PATH          "${DEFAULT_CONFIG_PATH}"
+#cmakedefine QPID_DISPATCH_HOME_INSTALLED "${QPID_DISPATCH_HOME_INSTALLED}"

Modified: qpid/dispatch/trunk/router/src/main.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/router/src/main.c?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/router/src/main.c (original)
+++ qpid/dispatch/trunk/router/src/main.c Tue Nov 26 14:58:09 2013
@@ -87,16 +87,19 @@ static void startup(void *context)
 
 int main(int argc, char **argv)
 {
-    const char *config_path = DEFAULT_CONFIG_PATH;
+#define DEFAULT_DISPATCH_PYTHON_DIR QPID_DISPATCH_HOME_INSTALLED "/python"
+    const char *config_path   = DEFAULT_CONFIG_PATH;
+    const char *python_pkgdir = DEFAULT_DISPATCH_PYTHON_DIR;
 
     static struct option long_options[] = {
-    {"config", required_argument, 0, 'c'},
-    {"help",   no_argument,       0, 'h'},
-    {0,        0,                 0,  0}
+    {"config",  required_argument, 0, 'c'},
+    {"include", required_argument, 0, 'I'},
+    {"help",    no_argument,       0, 'h'},
+    {0,         0,                 0,  0}
     };
 
     while (1) {
-        int c = getopt_long(argc, argv, "c:h", long_options, 0);
+        int c = getopt_long(argc, argv, "c:I:h", long_options, 0);
         if (c == -1)
             break;
 
@@ -105,10 +108,16 @@ int main(int argc, char **argv)
             config_path = optarg;
             break;
 
+        case 'I' :
+            python_pkgdir = optarg;
+            break;
+
         case 'h' :
             printf("Usage: %s [OPTION]\n\n", argv[0]);
             printf("  -c, --config=PATH (%s)\n", DEFAULT_CONFIG_PATH);
             printf("                             Load configuration from file at PATH\n");
+            printf("  -I, --include=PATH (%s)\n", DEFAULT_DISPATCH_PYTHON_DIR);
+            printf("                             Location of Dispatch's Python library\n");
             printf("  -h, --help                 Print this help\n");
             exit(0);
 
@@ -119,7 +128,7 @@ int main(int argc, char **argv)
 
     qd_log_set_mask(0xFFFFFFFE);
 
-    dispatch = qd_dispatch(config_path);
+    dispatch = qd_dispatch(config_path, python_pkgdir);
 
     qd_server_set_signal_handler(dispatch, server_signal_handler, 0);
     qd_server_set_start_handler(dispatch, thread_start_handler, 0);

Modified: qpid/dispatch/trunk/src/config.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/config.c?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/config.c (original)
+++ qpid/dispatch/trunk/src/config.c Tue Nov 26 14:58:09 2013
@@ -22,7 +22,7 @@
 #include <qpid/dispatch/alloc.h>
 #include <qpid/dispatch/log.h>
 
-#define PYTHON_MODULE "qpid_dispatch.config"
+#define PYTHON_MODULE "qpid_dispatch_internal.config"
 
 static const char *log_module = "CONFIG";
 

Modified: qpid/dispatch/trunk/src/dispatch.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/dispatch.c?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/dispatch.c (original)
+++ qpid/dispatch/trunk/src/dispatch.c Tue Nov 26 14:58:09 2013
@@ -50,7 +50,8 @@ static const char *CONF_LISTENER    = "l
 static const char *CONF_CONNECTOR   = "connector";
 
 
-qd_dispatch_t *qd_dispatch(const char *config_path)
+qd_dispatch_t *qd_dispatch(const char *config_path,
+                           const char *python_pkgdir)
 {
     qd_dispatch_t *qd = NEW(qd_dispatch_t);
 
@@ -65,7 +66,7 @@ qd_dispatch_t *qd_dispatch(const char *c
     DEQ_INIT(qd->config_listeners);
     DEQ_INIT(qd->config_connectors);
 
-    qd_python_initialize(qd);
+    qd_python_initialize(qd, python_pkgdir);
     qd_log_initialize();
     qd_alloc_initialize();
 

Modified: qpid/dispatch/trunk/src/python_embedded.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/python_embedded.c?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/python_embedded.c (original)
+++ qpid/dispatch/trunk/src/python_embedded.c Tue Nov 26 14:58:09 2013
@@ -34,14 +34,18 @@ static uint32_t       ref_count  = 0;
 static sys_mutex_t   *lock       = 0;
 static char          *log_module = "PYTHON";
 static PyObject      *dispatch_module = 0;
+static PyObject      *dispatch_python_pkgdir = 0;
 
 static void qd_python_setup();
 
 
-void qd_python_initialize(qd_dispatch_t *qd)
+void qd_python_initialize(qd_dispatch_t *qd,
+                          const char    *python_pkgdir)
 {
     dispatch = qd;
     lock = sys_mutex();
+    if (python_pkgdir)
+        dispatch_python_pkgdir = PyString_FromString(python_pkgdir);
 }
 
 
@@ -642,6 +646,14 @@ static void qd_python_setup()
         PyObject *m = Py_InitModule3("dispatch", empty_methods, "Dispatch Adapter Module");
 
         //
+        // Append sys.path to include location of Dispatch libraries
+        //
+        if (dispatch_python_pkgdir) {
+            PyObject *sys_path = PySys_GetObject("path");
+            PyList_Append(sys_path, dispatch_python_pkgdir);
+        }
+
+        //
         // Add LogAdapter
         //
         PyTypeObject *laType = &LogAdapterType;

Modified: qpid/dispatch/trunk/src/router_pynode.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/router_pynode.c?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/router_pynode.c (original)
+++ qpid/dispatch/trunk/src/router_pynode.c Tue Nov 26 14:58:09 2013
@@ -538,7 +538,7 @@ void qd_router_python_setup(qd_router_t 
     PyObject* pClass;
     PyObject* pArgs;
 
-    pName   = PyString_FromString("qpid_dispatch.router");
+    pName   = PyString_FromString("qpid_dispatch_internal.router");
     pModule = PyImport_Import(pName);
     Py_DECREF(pName);
     if (!pModule) {

Modified: qpid/dispatch/trunk/tests/router_engine_test.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/router_engine_test.py?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/router_engine_test.py (original)
+++ qpid/dispatch/trunk/tests/router_engine_test.py Tue Nov 26 14:58:09 2013
@@ -18,8 +18,8 @@
 #
 
 import unittest
-from qpid_dispatch.router.engine import NeighborEngine, PathEngine, Configuration, NodeTracker
-from qpid_dispatch.router.data import LinkState, MessageHELLO
+from qpid_dispatch_internal.router.engine import NeighborEngine, PathEngine, Configuration,
NodeTracker
+from qpid_dispatch_internal.router.data import LinkState, MessageHELLO
 
 class Adapter(object):
     def __init__(self, domain):

Modified: qpid/dispatch/trunk/tests/server_test.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/server_test.c?rev=1545678&r1=1545677&r2=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/server_test.c (original)
+++ qpid/dispatch/trunk/tests/server_test.c Tue Nov 26 14:58:09 2013
@@ -117,7 +117,7 @@ static char* test_start_handler(void *co
 {
     int i;
 
-    qd = qd_dispatch(config_file);
+    qd = qd_dispatch(config_file, 0);
 
     expected_context = (void*) 0x00112233;
     stored_error[0] = 0x0;
@@ -140,7 +140,7 @@ static char* test_start_handler(void *co
 
 static char *test_server_start(void *context)
 {
-    qd = qd_dispatch(config_file);
+    qd = qd_dispatch(config_file, 0);
     qd_server_start(qd);
     qd_server_stop(qd);
     qd_dispatch_free(qd);
@@ -154,7 +154,7 @@ static char* test_user_fd(void *context)
     int res;
     qd_timer_t *timer;
 
-    qd = qd_dispatch(config_file);
+    qd = qd_dispatch(config_file, 0);
     qd_server_set_user_fd_handler(qd, ufd_handler);
     timer = qd_timer(qd, fd_test_start, 0);
     qd_timer_schedule(timer, 0);

Copied: qpid/dispatch/trunk/tools/qdstat.in (from r1544173, qpid/dispatch/trunk/tools/qdstat)
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tools/qdstat.in?p2=qpid/dispatch/trunk/tools/qdstat.in&p1=qpid/dispatch/trunk/tools/qdstat&r1=1544173&r2=1545678&rev=1545678&view=diff
==============================================================================
--- qpid/dispatch/trunk/tools/qdstat (original)
+++ qpid/dispatch/trunk/tools/qdstat.in Tue Nov 26 14:58:09 2013
@@ -27,10 +27,10 @@ import socket
 import re
 from proton import Messenger, Message
 
-home = os.environ.get("QD_TOOLS_HOME", os.path.normpath("/usr/share/qd-tools"))
+home = os.environ.get("QPID_DISPATCH_HOME", os.path.normpath("${QPID_DISPATCH_HOME}"))
 sys.path.append(os.path.join(home, "python"))
 
-from qpid_dispatch.tools import Display, Header, Sorter, YN, Commas, TimeLong
+from qpid_dispatch_internal.tools import Display, Header, Sorter, YN, Commas, TimeLong
 
 
 class Config:



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


Mime
View raw message