components/python/librabbitmq/patches/studio.patch
branchs11-update
changeset 2785 b6f5c5d1d0b7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/librabbitmq/patches/studio.patch	Wed Oct 09 07:10:15 2013 -0700
@@ -0,0 +1,96 @@
+Remove the use of gcc-specific flags.
+And don't regenerate amqp_framing.[ch] if the source hasn't changed.
+
+Without the patch to connection.c, we get
+
+    "Modules/_librabbitmq/connection.c", line 465: reference to static identifier "AMQTable_toPyDict" in extern inline function
+    "Modules/_librabbitmq/connection.c", line 685: reference to static identifier "PyDict_ToAMQTable" in extern inline function
+
+from Studio.  These are new since 0.9.9, where we didn't have this problem.
+Not sure what the right fix is.
+
+Finally, we inherit CFLAGS and LDFLAGS from the environment rather than
+using what Python was compiled with. In particular, Python 2.7 in
+Userland currently has some undesired settings such as including
+/usr/gnu/lib in the RUNPATH.
+
+--- librabbitmq-1.0.1/setup.py	Mon Jan 14 06:05:35 2013
++++ librabbitmq-1.0.1/setup.py	Mon Sep  2 14:25:44 2013
+@@ -3,6 +3,7 @@
+ import sys
+ from glob import glob
+ from setuptools import setup, find_packages
++from distutils.dep_util import newer
+ 
+ # --with-librabbitmq=<dir>: path to librabbitmq package if needed
+ 
+@@ -26,9 +27,15 @@
+     codegen = LRMQSRC('codegen.py')
+     spec = SPECPATH('amqp-rabbitmq-0.9.1.json')
+     sys.path.insert(0, SPECPATH())
++    hfile = LRMQSRC('amqp_framing.h')
++    cfile = LRMQSRC('amqp_framing.c')
++    # Don't regenerate the files if the spec file hasn't changed.  This prevents
++    # a separate install phase from unnecessarily rebuilding the extension.
++    if not (newer(spec, hfile) or newer(spec, cfile)):
++            return
+     commands = [
+-        (sys.executable, codegen, 'header', spec, LRMQSRC('amqp_framing.h')),
+-        (sys.executable, codegen, 'body', spec, LRMQSRC('amqp_framing.c')),
++        (sys.executable, codegen, 'header', spec, hfile),
++        (sys.executable, codegen, 'body', spec, cfile),
+     ]
+     restore = senv(('PYTHONPATH', SPECPATH()), sep=':')
+     try:
+@@ -112,7 +119,7 @@
+ 
+     class build(_build):
+         stdcflags = [
+-            '-W -Wall -DHAVE_CONFIG_H',
++            '-DHAVE_CONFIG_H',
+         ]
+         if os.environ.get('PEDANTIC'):
+             # Python.h breaks -pedantic, so can only use it while developing.
+@@ -124,8 +131,7 @@
+             from distutils import sysconfig
+             config = sysconfig.get_config_vars()
+             try:
+-                restore = senv(('CFLAGS', config['CFLAGS']),
+-                    ('LDFLAGS', config['LDFLAGS']))
++                restore = senv()
+                 try:
+                     os.chdir(LRMQDIST())
+                     if not os.path.isfile('config.h'):
+--- librabbitmq-1.0.1/Modules/_librabbitmq/connection.c	Mon Jan 14 04:48:57 2013
++++ librabbitmq-1.0.1/Modules/_librabbitmq/connection.c	Mon Apr  8 16:01:05 2013
+@@ -62,10 +62,10 @@
+ _PYRMQ_INLINE int RabbitMQ_wait_nb(int);
+ _PYRMQ_INLINE int RabbitMQ_wait_timeout(int, double);
+ 
+-_PYRMQ_INLINE void
++void
+ basic_properties_to_PyDict(amqp_basic_properties_t*, PyObject*);
+ 
+-_PYRMQ_INLINE int
++int
+ PyDict_to_basic_properties(PyObject *,
+                            amqp_basic_properties_t *,
+                            amqp_connection_state_t );
+@@ -408,7 +408,7 @@
+ }
+ 
+ 
+-_PYRMQ_INLINE void
++void
+ basic_properties_to_PyDict(amqp_basic_properties_t *props, PyObject *p)
+ {
+     register PyObject *value = NULL;
+@@ -614,7 +614,7 @@
+ }
+ 
+ 
+-_PYRMQ_INLINE int
++int
+ PyDict_to_basic_properties(PyObject *p,
+                            amqp_basic_properties_t *props,
+                            amqp_connection_state_t conn)