<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/71f0a31d165c5543fe994cded07a27199429318a">https://github.com/macports/macports-ports/commit/71f0a31d165c5543fe994cded07a27199429318a</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 71f0a31d165 py-pypcap: update exception syntax
</span>71f0a31d165 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 71f0a31d165c5543fe994cded07a27199429318a
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Sat Apr 1 11:30:44 2023 +1100
<span style='display:block; white-space:pre;color:#404040;'> py-pypcap: update exception syntax
</span>---
python/py-pypcap/Portfile | 1 +
python/py-pypcap/files/py3.patch | 102 +++++++++++++++++++++++++++++++++++++--
2 files changed, 99 insertions(+), 4 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/python/py-pypcap/Portfile b/python/py-pypcap/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 1d4b6c77463..6549a003bdf 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/python/py-pypcap/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/python/py-pypcap/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5,6 +5,7 @@ PortGroup python 1.0
</span>
name py-pypcap
version 1.1
<span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 1
</span> categories-append net
license BSD
maintainers gmail.com:andrew.reusch openmaintainer
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/python/py-pypcap/files/py3.patch b/python/py-pypcap/files/py3.patch
</span><span style='display:block; white-space:pre;color:#808080;'>index df530fcf01a..dcb44f22bb6 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/python/py-pypcap/files/py3.patch
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/python/py-pypcap/files/py3.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,5 +1,5 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- pcap.pyx.orig 2022-10-20 23:22:40.000000000 +1100
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ pcap.pyx 2022-10-20 23:25:38.000000000 +1100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- pcap.pyx.orig 2023-04-01 11:07:48
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ pcap.pyx 2023-04-01 11:21:06
</span> @@ -20,7 +20,8 @@
import struct
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -19,7 +19,74 @@
</span> *(<object>ctx.args))
except:
ctx.got_exc = 1
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -318,7 +319,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -142,7 +143,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cdef bpf_program fcode
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def __init__(self, char *filter, dlt=DLT_RAW):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if pcap_ex_compile_nopcap(65535, dlt, &self.fcode, filter, 1, 0) < 0:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise IOError, 'bad filter'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise IOError('bad filter')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def filter(self, buf):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """Return boolean match for buf against our filter."""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cdef char *p
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -184,7 +185,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if not name:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ p = pcap_ex_lookupdev(self.__ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if p == NULL:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, self.__ebuf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(self.__ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ p = name
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -193,14 +194,14 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.__pcap = pcap_open_live(pcap_ex_name(p), snaplen, promisc,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ timeout_ms, self.__ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if not self.__pcap:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, self.__ebuf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(self.__ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.__name = strdup(p)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.__filter = strdup("")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ try: self.__dloff = dltoff[pcap_datalink(self.__pcap)]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ except KeyError: pass
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if immediate and pcap_ex_immediate(self.__pcap) < 0:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, "couldn't enable immediate mode"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError("couldn't enable immediate mode")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ property name:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """Network interface or dumpfile name."""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -237,9 +238,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ free(self.__filter)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.__filter = strdup(value)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if pcap_compile(self.__pcap, &fcode, self.__filter, optimize, 0) < 0:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, pcap_geterr(self.__pcap)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(pcap_geterr(self.__pcap))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if pcap_setfilter(self.__pcap, &fcode) < 0:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, pcap_geterr(self.__pcap)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(pcap_geterr(self.__pcap))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pcap_freecode(&fcode)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def setnonblock(self, nonblock=True):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -250,7 +251,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """Return non-blocking capture mode as boolean."""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ret = pcap_ex_getnonblock(self.__pcap, self.__ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ret < 0:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, self.__ebuf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(self.__ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ elif ret:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return True
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return False
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -291,7 +292,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <unsigned char *>&ctx)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ctx.got_exc:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exc = sys.exc_info()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise exc[0], exc[1], exc[2]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ e = exc[0](exc[1])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ e.__traceback__ = exc[2]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise e
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return n
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def loop(self, cnt, callback, *args):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -318,7 +321,7 @@
</span> n = pcap_ex_next(self.__pcap, &hdr, &pkt)
if n == 1:
callback(hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0),
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -28,7 +95,25 @@
</span> elif n == 0:
break
elif n == -1:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -361,7 +362,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -333,7 +336,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ """Send a raw network packet on the interface."""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ret = pcap_sendpacket(self.__pcap, buf, len(buf))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ret == -1:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, pcap_geterr(self.__pcap)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(pcap_geterr(self.__pcap))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return len(buf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def geterr(self):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -345,7 +348,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dropped, and dropped by the interface."""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cdef pcap_stat pstat
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if pcap_stats(self.__pcap, &pstat) < 0:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, pcap_geterr(self.__pcap)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(pcap_geterr(self.__pcap))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return (pstat.ps_recv, pstat.ps_drop, pstat.ps_ifdrop)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def __iter__(self):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -361,7 +364,7 @@
</span> n = pcap_ex_next(self.__pcap, &hdr, &pkt)
if n == 1:
return (hdr.ts.tv_sec + (hdr.ts.tv_usec / 1000000.0),
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -37,3 +122,12 @@
</span> elif n == 0:
return None
elif n == -1:
<span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -385,7 +388,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cdef char *p, ebuf[256]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ p = pcap_ex_lookupdev(ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if p == NULL:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- raise OSError, ebuf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ raise OSError(ebuf)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return p
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ def findalldevs():
</span></pre><pre style='margin:0'>
</pre>