components/python/librabbitmq/patches/studio.patch
changeset 6410 3ae42b2b5dad
parent 6409 a57c61602ca6
child 6411 76a1152cb6f7
equal deleted inserted replaced
6409:a57c61602ca6 6410:3ae42b2b5dad
     1 Remove the use of gcc-specific flags.
       
     2 And don't regenerate amqp_framing.[ch] if the source hasn't changed.
       
     3 
       
     4 Without the patch to connection.c, we get
       
     5 
       
     6     "Modules/_librabbitmq/connection.c", line 465: reference to static identifier "AMQTable_toPyDict" in extern inline function
       
     7     "Modules/_librabbitmq/connection.c", line 685: reference to static identifier "PyDict_ToAMQTable" in extern inline function
       
     8 
       
     9 from Studio.  These are new since 0.9.9, where we didn't have this problem.
       
    10 Not sure what the right fix is.
       
    11 
       
    12 Finally, we inherit CFLAGS and LDFLAGS from the environment rather than
       
    13 using what Python was compiled with. In particular, Python 2.7 in
       
    14 Userland currently has some undesired settings such as including
       
    15 /usr/gnu/lib in the RUNPATH.
       
    16 
       
    17 --- librabbitmq-1.0.1/setup.py	Mon Jan 14 06:05:35 2013
       
    18 +++ librabbitmq-1.0.1/setup.py	Mon Sep  2 14:25:44 2013
       
    19 @@ -3,6 +3,7 @@
       
    20  import sys
       
    21  from glob import glob
       
    22  from setuptools import setup, find_packages
       
    23 +from distutils.dep_util import newer
       
    24  
       
    25  # --with-librabbitmq=<dir>: path to librabbitmq package if needed
       
    26  
       
    27 @@ -26,9 +27,15 @@
       
    28      codegen = LRMQSRC('codegen.py')
       
    29      spec = SPECPATH('amqp-rabbitmq-0.9.1.json')
       
    30      sys.path.insert(0, SPECPATH())
       
    31 +    hfile = LRMQSRC('amqp_framing.h')
       
    32 +    cfile = LRMQSRC('amqp_framing.c')
       
    33 +    # Don't regenerate the files if the spec file hasn't changed.  This prevents
       
    34 +    # a separate install phase from unnecessarily rebuilding the extension.
       
    35 +    if not (newer(spec, hfile) or newer(spec, cfile)):
       
    36 +            return
       
    37      commands = [
       
    38 -        (sys.executable, codegen, 'header', spec, LRMQSRC('amqp_framing.h')),
       
    39 -        (sys.executable, codegen, 'body', spec, LRMQSRC('amqp_framing.c')),
       
    40 +        (sys.executable, codegen, 'header', spec, hfile),
       
    41 +        (sys.executable, codegen, 'body', spec, cfile),
       
    42      ]
       
    43      restore = senv(('PYTHONPATH', SPECPATH()), sep=':')
       
    44      try:
       
    45 @@ -112,7 +119,7 @@
       
    46  
       
    47      class build(_build):
       
    48          stdcflags = [
       
    49 -            '-W -Wall -DHAVE_CONFIG_H',
       
    50 +            '-DHAVE_CONFIG_H',
       
    51          ]
       
    52          if os.environ.get('PEDANTIC'):
       
    53              # Python.h breaks -pedantic, so can only use it while developing.
       
    54 @@ -124,8 +131,7 @@
       
    55              from distutils import sysconfig
       
    56              config = sysconfig.get_config_vars()
       
    57              try:
       
    58 -                restore = senv(('CFLAGS', config['CFLAGS']),
       
    59 -                    ('LDFLAGS', config['LDFLAGS']))
       
    60 +                restore = senv()
       
    61                  try:
       
    62                      os.chdir(LRMQDIST())
       
    63                      if not os.path.isfile('config.h'):
       
    64 --- librabbitmq-1.0.1/Modules/_librabbitmq/connection.c	Mon Jan 14 04:48:57 2013
       
    65 +++ librabbitmq-1.0.1/Modules/_librabbitmq/connection.c	Mon Apr  8 16:01:05 2013
       
    66 @@ -62,10 +62,10 @@
       
    67  _PYRMQ_INLINE int RabbitMQ_wait_nb(int);
       
    68  _PYRMQ_INLINE int RabbitMQ_wait_timeout(int, double);
       
    69  
       
    70 -_PYRMQ_INLINE void
       
    71 +void
       
    72  basic_properties_to_PyDict(amqp_basic_properties_t*, PyObject*);
       
    73  
       
    74 -_PYRMQ_INLINE int
       
    75 +int
       
    76  PyDict_to_basic_properties(PyObject *,
       
    77                             amqp_basic_properties_t *,
       
    78                             amqp_connection_state_t );
       
    79 @@ -408,7 +408,7 @@
       
    80  }
       
    81  
       
    82  
       
    83 -_PYRMQ_INLINE void
       
    84 +void
       
    85  basic_properties_to_PyDict(amqp_basic_properties_t *props, PyObject *p)
       
    86  {
       
    87      register PyObject *value = NULL;
       
    88 @@ -614,7 +614,7 @@
       
    89  }
       
    90  
       
    91  
       
    92 -_PYRMQ_INLINE int
       
    93 +int
       
    94  PyDict_to_basic_properties(PyObject *p,
       
    95                             amqp_basic_properties_t *props,
       
    96                             amqp_connection_state_t conn)