[105335] trunk/dports/python/py-protobuf

blair at macports.org blair at macports.org
Wed Apr 17 17:21:20 PDT 2013


Revision: 105335
          https://trac.macports.org/changeset/105335
Author:   blair at macports.org
Date:     2013-04-17 17:21:20 -0700 (Wed, 17 Apr 2013)
Log Message:
-----------
py-protobuf: update to 2.5.0; partially resolves #38835.

1) I disabled the PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp feature
   since enabling it causes using test failures when the pure Python
   code passes the unit tests successfully.  I don't want people to
   get encoding or decoding errors.  See [1].
2) Add a patch to switch from:
     except Exception as e:
   to
     except Exception, e:
   syntax since the newer syntax isn't supported in Python 2.5 and
   older.

[1] http://code.google.com/p/protobuf/issues/detail?id=503

Modified Paths:
--------------
    trunk/dports/python/py-protobuf/Portfile

Added Paths:
-----------
    trunk/dports/python/py-protobuf/files/
    trunk/dports/python/py-protobuf/files/patch-python-except-clause-compatibility.diff

Modified: trunk/dports/python/py-protobuf/Portfile
===================================================================
--- trunk/dports/python/py-protobuf/Portfile	2013-04-18 00:18:05 UTC (rev 105334)
+++ trunk/dports/python/py-protobuf/Portfile	2013-04-18 00:21:20 UTC (rev 105335)
@@ -4,8 +4,7 @@
 PortGroup       python 1.0
 
 name            py-protobuf
-version         2.4.1
-revision        1
+version         2.5.0
 categories-append   devel
 maintainers     blair
 license         BSD
@@ -34,9 +33,8 @@
 distname        protobuf-${version}
 dist_subdir     protobuf-cpp
 use_bzip2       yes
-checksums       md5 ed436802019c9e1f40cc750eaf78f318 \
-                sha1 df5867e37a4b51fb69f53a8baf5b994938691d6d \
-                rmd160 405eccad08463c2f84064bb68d8a8e757235765f
+checksums       sha1   62c10dcdac4b69cc8c6bb19f73db40c264cb2726 \
+                sha256 13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677
 
 platforms       darwin
 
@@ -48,13 +46,22 @@
 
     worksrcdir      ${worksrcdir}/python
 
-    build.env       PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
+    patchfiles      patch-python-except-clause-compatibility.diff
+
+    # PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp is disabled until
+    # this bug [1] is fixed.  Better to ensure that the Python
+    # protobuf bindings slowly and properly encode and decode data
+    # then quickly fail ;)
+    #
+    # [1] http://code.google.com/p/protobuf/issues/detail?id=503
+
+    # build.env       PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
     build.cmd-append    build_ext -I${prefix}/include
 
-    destroot.env    PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
+    # destroot.env    PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
 
     test.run        yes
-    test.env        PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
+    # test.env        PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
     test.cmd        "${python.bin} setup.py"
     test.target     test
 }

Added: trunk/dports/python/py-protobuf/files/patch-python-except-clause-compatibility.diff
===================================================================
--- trunk/dports/python/py-protobuf/files/patch-python-except-clause-compatibility.diff	                        (rev 0)
+++ trunk/dports/python/py-protobuf/files/patch-python-except-clause-compatibility.diff	2013-04-18 00:21:20 UTC (rev 105335)
@@ -0,0 +1,54 @@
+diff -ru ../../protobuf-2.5.0.orig/python/google/protobuf/descriptor_pool.py ./google/protobuf/descriptor_pool.py
+--- ../../protobuf-2.5.0.orig/python/google/protobuf/descriptor_pool.py	2013-02-26 09:56:33.000000000 -0800
++++ ./google/protobuf/descriptor_pool.py	2013-04-17 16:11:05.000000000 -0700
+@@ -104,7 +104,7 @@
+ 
+     try:
+       file_proto = self._internal_db.FindFileByName(file_name)
+-    except KeyError as error:
++    except KeyError, error:
+       if self._descriptor_db:
+         file_proto = self._descriptor_db.FindFileByName(file_name)
+       else:
+@@ -128,7 +128,7 @@
+ 
+     try:
+       file_proto = self._internal_db.FindFileContainingSymbol(symbol)
+-    except KeyError as error:
++    except KeyError, error:
+       if self._descriptor_db:
+         file_proto = self._descriptor_db.FindFileContainingSymbol(symbol)
+       else:
+diff -ru ../../protobuf-2.5.0.orig/python/google/protobuf/internal/reflection_test.py ./google/protobuf/internal/reflection_test.py
+--- ../../protobuf-2.5.0.orig/python/google/protobuf/internal/reflection_test.py	2013-02-26 09:56:33.000000000 -0800
++++ ./google/protobuf/internal/reflection_test.py	2013-04-17 16:10:38.000000000 -0700
+@@ -1650,7 +1650,7 @@
+     unicode_decode_failed = False
+     try:
+       message2.MergeFromString(bytes)
+-    except UnicodeDecodeError as e:
++    except UnicodeDecodeError:
+       unicode_decode_failed = True
+     string_field = message2.str
+     self.assertTrue(unicode_decode_failed or type(string_field) == str)
+@@ -2361,7 +2361,7 @@
+     """This method checks if the excpetion type and message are as expected."""
+     try:
+       callable_obj()
+-    except exc_class as ex:
++    except exc_class, ex:
+       # Check if the exception message is the right one.
+       self.assertEqual(exception, str(ex))
+       return
+diff -ru ../../protobuf-2.5.0.orig/python/google/protobuf/internal/text_format_test.py ./google/protobuf/internal/text_format_test.py
+--- ../../protobuf-2.5.0.orig/python/google/protobuf/internal/text_format_test.py	2013-02-26 09:56:33.000000000 -0800
++++ ./google/protobuf/internal/text_format_test.py	2013-04-17 16:11:19.000000000 -0700
+@@ -458,7 +458,7 @@
+ 
+     try:
+       func(*args, **kwargs)
+-    except e_class as expr:
++    except e_class, expr:
+       if str(expr) != e:
+         msg = '%s raised, but with wrong message: "%s" instead of "%s"'
+         raise self.failureException(msg % (exc_name,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130417/bfa59f1c/attachment-0001.html>


More information about the macports-changes mailing list