Avro
  1. Avro
  2. AVRO-588

Allow Python implementation of Avro to be used with Python 2.4

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.4.0
    • Component/s: python
    • Labels:
      None
    1. AVRO-588-3.patch
      31 kB
      Jeff Hammerbacher
    2. AVRO-588-2.patch
      9 kB
      Jeff Hammerbacher
    3. AVRO-588.patch
      5 kB
      Jeff Hammerbacher

      Issue Links

        Activity

        Hide
        Jeff Hammerbacher added a comment -

        CentOS 5 is still shipping it, so we should make it work.

        Current issue is our use of struct.Struct objects in io.py.

        Show
        Jeff Hammerbacher added a comment - CentOS 5 is still shipping it, so we should make it work. Current issue is our use of struct.Struct objects in io.py .
        Hide
        Jeff Hammerbacher added a comment -

        Same issue in ipc.py

        Show
        Jeff Hammerbacher added a comment - Same issue in ipc.py
        Hide
        Jeff Hammerbacher added a comment -

        Also, in protocol.py, the change introduced by AVRO-451 will break if the hashlib module is not available.

        Show
        Jeff Hammerbacher added a comment - Also, in protocol.py , the change introduced by AVRO-451 will break if the hashlib module is not available.
        Hide
        Bruce Mitchener added a comment -

        Why would the change from AVRO-451 break? It was written in my patch to still work on Python 2.4.

        Show
        Bruce Mitchener added a comment - Why would the change from AVRO-451 break? It was written in my patch to still work on Python 2.4.
        Hide
        Jeff Hammerbacher added a comment -

        Not sure about the performance impact of this patch, but it should do the trick.

        Show
        Jeff Hammerbacher added a comment - Not sure about the performance impact of this patch, but it should do the trick.
        Hide
        Jeff Hammerbacher added a comment -

        Bruce: if we don't import the module hashlib, then the hashlib name is undefined. If you subsequently say if hashlib, you're going to throw a NameError

        Show
        Jeff Hammerbacher added a comment - Bruce: if we don't import the module hashlib , then the hashlib name is undefined. If you subsequently say if hashlib , you're going to throw a NameError
        Hide
        Bruce Mitchener added a comment -

        Lame error on my part then ... Your fix for that part looks good.

        Show
        Bruce Mitchener added a comment - Lame error on my part then ... Your fix for that part looks good.
        Hide
        Jeff Hammerbacher added a comment -

        Found another fun one: we use finally in test_protocol.py and test_schema.py

        Show
        Jeff Hammerbacher added a comment - Found another fun one: we use finally in test_protocol.py and test_schema.py
        Hide
        Michael Greene added a comment -

        Not important, but wouldn't
        {{
        try:
        from hashlib import md5
        except ImportError:
        from md5 import md5
        }}
        be simpler and preferable? or "as compute_md5" if you're stuck on that.

        Show
        Michael Greene added a comment - Not important, but wouldn't {{ try: from hashlib import md5 except ImportError: from md5 import md5 }} be simpler and preferable? or "as compute_md5" if you're stuck on that.
        Hide
        Jeff Hammerbacher added a comment -

        Michael: I'll check it out. The code currently calls hashlib.md5() or md5.new(), so your idea would not work as it currently stands, as the latter appears to use a factory.

        Show
        Jeff Hammerbacher added a comment - Michael: I'll check it out. The code currently calls hashlib.md5() or md5.new() , so your idea would not work as it currently stands, as the latter appears to use a factory.
        Hide
        Michael Greene added a comment -

        http://docs.python.org/library/md5.html#md5.md5 md5.new and md5.md5 are the same thing.

        Show
        Michael Greene added a comment - http://docs.python.org/library/md5.html#md5.md5 md5.new and md5.md5 are the same thing.
        Hide
        Jeff Hammerbacher added a comment -

        Yep, that's what I wanted to confirm once I got in front of a computer. Your way is certainly cleaner, so I'll update the patch.

        Show
        Jeff Hammerbacher added a comment - Yep, that's what I wanted to confirm once I got in front of a computer. Your way is certainly cleaner, so I'll update the patch.
        Hide
        Jeff Hammerbacher added a comment -

        I've addressed most of the issues (thanks for the comments!) but I'm stuck on how to modify our use of the uuid module, which appeared in Python 2.5. I've asked on Quora about the best way to generate RFC 4122-compliant UUIDs in Python 2.4: http://www.quora.com/What's-the-best-way-to-generate-RFC-4122-compliant-UUIDs-in-Python-2.4. If you happen to know the answer, please let me know!

        Show
        Jeff Hammerbacher added a comment - I've addressed most of the issues (thanks for the comments!) but I'm stuck on how to modify our use of the uuid module, which appeared in Python 2.5. I've asked on Quora about the best way to generate RFC 4122-compliant UUIDs in Python 2.4: http://www.quora.com/What's-the-best-way-to-generate-RFC-4122-compliant-UUIDs-in-Python-2.4 . If you happen to know the answer, please let me know!
        Hide
        Jeff Hammerbacher added a comment -

        Okay, added uuid_24.py by taking the source from http://svn.python.org/projects/python/trunk/Lib/uuid.py. I need to figure out the right way to license it, but I'd love it if someone else could take this patch for a spin on a Python 2.4 installation and see if it works for them.

        Show
        Jeff Hammerbacher added a comment - Okay, added uuid_24.py by taking the source from http://svn.python.org/projects/python/trunk/Lib/uuid.py . I need to figure out the right way to license it, but I'd love it if someone else could take this patch for a spin on a Python 2.4 installation and see if it works for them.
        Hide
        Doug Cutting added a comment -

        The uuid code is under the PSF license:

        http://www.opensource.org/licenses/PythonSoftFoundation.php

        This requires that we include a copyright statement and a copy of the license in our distributions. HTTPD provides a good model. Look at the end of:

        https://svn.apache.org/repos/asf/httpd/httpd/trunk/LICENSE

        So, in our LICENSE.txt file, we should add sections at the end for sub-components whose licenses differ, providing the relative path for each such subcomponent followed by its copyright and licence. We already have one such appended license, but it should probably be amended to provide the path, and we should add an introductory paragraph for all sub-component licenses. In short, we should model the structure of HTTPD's LICENSE.

        Show
        Doug Cutting added a comment - The uuid code is under the PSF license: http://www.opensource.org/licenses/PythonSoftFoundation.php This requires that we include a copyright statement and a copy of the license in our distributions. HTTPD provides a good model. Look at the end of: https://svn.apache.org/repos/asf/httpd/httpd/trunk/LICENSE So, in our LICENSE.txt file, we should add sections at the end for sub-components whose licenses differ, providing the relative path for each such subcomponent followed by its copyright and licence. We already have one such appended license, but it should probably be amended to provide the path, and we should add an introductory paragraph for all sub-component licenses. In short, we should model the structure of HTTPD's LICENSE.

          People

          • Assignee:
            Jeff Hammerbacher
            Reporter:
            Jeff Hammerbacher
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development