pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
py-csp: Fix IP address resolution on NetBSD
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Sun Sep 25 00:51:17 2016 +0200
Changeset: 0f03dbde7efa691c86b287c761541984d380e1d5
Modified Files:
py-csp/distinfo
Added Files:
py-csp/patches/patch-pycsp_parallel_ossocket.py
Log Message:
py-csp: Fix IP address resolution on NetBSD
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=0f03dbde7efa691c86b287c761541984d380e1d5
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
py-csp/distinfo | 1 +
py-csp/patches/patch-pycsp_parallel_ossocket.py | 49 +++++++++++++++++++++++++
2 files changed, 50 insertions(+)
diffs:
diff --git a/py-csp/distinfo b/py-csp/distinfo
index 7463883..2130056 100644
--- a/py-csp/distinfo
+++ b/py-csp/distinfo
@@ -4,3 +4,4 @@ SHA1 (pycsp-0.9.2.tar.gz) = 25e2d306592d42f015684ff152f1ffd0039be080
RMD160 (pycsp-0.9.2.tar.gz) = a444ab6d2df07159f51294063f9016ccc8b487c3
SHA512 (pycsp-0.9.2.tar.gz) = 4aa18fe9f63e68551ece9314e1b74fa0281b62973af97304d131ea9edc2b73317c6eafab3ee0c0438fdacd5988adf6185bedee9d31482772faef31b742528e90
Size (pycsp-0.9.2.tar.gz) = 118178 bytes
+SHA1 (patch-pycsp_parallel_ossocket.py) = 4c66ed032f629b6ac2b878b7a4b1f5ff341b4513
diff --git a/py-csp/patches/patch-pycsp_parallel_ossocket.py b/py-csp/patches/patch-pycsp_parallel_ossocket.py
new file mode 100644
index 0000000..38ea56d
--- /dev/null
+++ b/py-csp/patches/patch-pycsp_parallel_ossocket.py
@@ -0,0 +1,49 @@
+$NetBSD$
+
+--- pycsp/parallel/ossocket.py.orig 2016-04-20 17:39:32.000000000 +0000
++++ pycsp/parallel/ossocket.py
+@@ -23,33 +23,13 @@ STDERR_OUTPUT = False
+ conf = Configuration()
+
+ # Functions for retrieving LAN ip addresses
+-if os.name != "nt":
+- import fcntl
+- import struct
+-
+- def _get_interface_ip(ifname):
+- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+- ip = socket.inet_ntoa(fcntl.ioctl(
+- s.fileno(),
+- 0x8915, # SIOCGIFADDR
+- struct.pack('256s', ifname[:15])
+- )[20:24])
+- s.close()
+- return ip
+-
+ def _get_ip():
+- ip = socket.gethostbyname(socket.gethostname())
+- if ip.startswith("127.") and os.name != "nt":
+- interfaces = ["eth0","eth1","eth2","wlan0","wlan1","wifi0","ath0","ath1","ppp0"]
+- for ifname in interfaces:
+- try:
+- ip = _get_interface_ip(ifname)
+- break;
+- except IOError:
+- pass
++ from netifaces import interfaces, ifaddresses, AF_INET
++ for ifname in interfaces():
++ ip = [i['addr'] for i in ifaddresses(ifname).setdefault(AF_INET, [{'addr':'No IP addr'}] )][0]
++ if not ip.startswith("127."):
++ break
+ return ip
+-
+-
+
+ def _connect(addr, reconnect=True):
+ """
+@@ -329,5 +309,3 @@ class ConnHandler(object):
+ sock.close()
+
+ self.cacheSockets = {}
+-
+-
Home |
Main Index |
Thread Index |
Old Index