tags 542984 + patch upstream thanks Hello,
I poked around at this bug, and think I have a resolution. However, someone with more knowledge of swig/python3 c-api should sanity-check this. This module uses SWIG to generate pcap.c which is then compiled. However, first it uses build-tools/docify.py to transform the code. It automatically associates METHOD with _doc_METHOD and _wrap_METHOD. However, _doc_ has to be set up manually, and _wrap_ is only generated for "real" methods. I think that swig got updated for python3, and added the SWIG_PyInstanceMethod_New automatically generated method. However, the docify.py script transforms this to expect _doc_.. and _wrap_... methods for SWIG_PyInstanceMethod_New, which don't exist, thus failing. -> This patch adds SWIG_PyInstanceMethod_New to a list of methods -> which are not automatically _doc_METHOD and _wrap_METHOD'ified, After the package would compile and build, it would not byte-compile when it was being installed, because of another problem in build-tools/docify-shadow. This was doing more (python) source code transformation in pcap.py, but was broken by changing form of the source code swig output. -> Make the method name matching regex more flexible. Finally, there was a bug in the comparing a string to an int, to determine if it was running with python2, where it would use this system. So, all of this hack build system was for nothing, because it was comparing an int to a string in a way that was always false. So I fixed that. Unfortunately, I rebuilt against the next upstream release in this process. However, the previous CVS snapshot is mostly identical so this should work for either 0.6.1cvs or 0.6.2. I think. I've also attached my .diff.gz for 0.6.2 if you'd like to take the chance to upgrade to that release. (Please feel free to replace my changelog entry with one by you). It may need other policy checks in places, this was done mainly to fix the FTBFS, not upgrade to the next release. - Richard diff -r -u python-libpcap-0.6.1+cvs.2007.07.28/build-tools/docify-shadow.py python-libpcap-0.6.2/build-tools/docify-shadow.py --- python-libpcap-0.6.1+cvs.2007.07.28/build-tools/docify-shadow.py 2007-02-14 02:55:17.000000000 -0500 +++ python-libpcap-0.6.2/build-tools/docify-shadow.py 2009-11-13 18:27:47.000000000 -0500 @@ -65,7 +65,8 @@ # Make a dictionary of all the method names from the method lines. methods={} for line in pymeths: - methmatch=re.search('def +([^ (]*) *\(\*args\)',line) + methmatch=re.search('def +([^ (]*) *\((self)?(, )?(\*args)?\)',line) fnmatch=re.search('\:.*[^_p](_?pcapc?\.[^(, ]+) *[(,]',line) methode=None fname=None @@ -98,7 +99,7 @@ # put doc assignments inside of the __init__ outfile.write(' import sys\n') -outfile.write(' if int(sys.version[0])>=\'2\':\n') +outfile.write(' if int(sys.version[0])>=2:\n') for method, fname in methods.items(): outfile.write(' self.%s.im_func.__doc__ = %s.__doc__\n' % (method, fname)) diff -r -u python-libpcap-0.6.1+cvs.2007.07.28/build-tools/docify.py python-libpcap-0.6.2/build-tools/docify.py --- python-libpcap-0.6.1+cvs.2007.07.28/build-tools/docify.py 2007-02-14 02:55:17.000000000 -0500 +++ python-libpcap-0.6.2/build-tools/docify.py 2009-11-13 17:48:45.000000000 -0500 @@ -37,7 +37,8 @@ match=re.search('^.*char \*.*\".*\"',line) if match: fname=re.search('\".*\"',match.group(0)).group(0)[1:-1] - if re.search('swigregister',fname): + if re.search('swigregister|SWIG_PyInstanceMethod_New',fname): # print 'skipping doc string for %s\n' % fname outfile.write(line) continue -- | Richard Darst - rkd@ - ehrenfest: up 1 day, 5 | http://rkd.zgib.net - pgp 0xBD356740 | "Ye shall know the truth and -- the truth shall make you free"
python-libpcap_0.6.2-1.diff.gz
Description: Binary data