Files
haikuports/dev-python/ifaddr/patches/ifaddr-0.2.0.patchset
OscarL 895f5b7bc2 ifaddr: update to version 0.2.0. Add Haiku support. (#9452)
Not sure this ever worked before. Seems to work well enough now.
2023-09-19 08:56:26 +02:00

52 lines
1.5 KiB
Plaintext

From a571472c3694611813d66d40da4d5e04dbfba390 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Tue, 19 Sep 2023 03:10:43 -0300
Subject: Use correct lib for getifaddrs() on Haiku.
diff --git a/ifaddr/_posix.py b/ifaddr/_posix.py
index 5fb0d18..dcf574a 100644
--- a/ifaddr/_posix.py
+++ b/ifaddr/_posix.py
@@ -44,7 +44,13 @@ ifaddrs._fields_ = [
('ifa_netmask', ctypes.POINTER(shared.sockaddr)),
]
-libc = ctypes.CDLL(ctypes.util.find_library("socket" if os.uname()[0] == "SunOS" else "c"), use_errno=True) # type: ignore
+libname = "c"
+if os.uname()[0] == "SunOS":
+ libname = "socket"
+elif os.uname()[0] == "Haiku":
+ libname = "network"
+
+libc = ctypes.CDLL(ctypes.util.find_library(libname), use_errno=True) # type: ignore
def get_adapters(include_unconfigured: bool = False) -> Iterable[shared.Adapter]:
--
2.37.3
From 67f380f7ba5ace9dffbecb079198bd7b9e7f7409 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Tue, 19 Sep 2023 03:26:43 -0300
Subject: Use correct code path for Haiku.
diff --git a/ifaddr/_shared.py b/ifaddr/_shared.py
index 40f6edd..4caaec2 100644
--- a/ifaddr/_shared.py
+++ b/ifaddr/_shared.py
@@ -118,7 +118,7 @@ class IP(object):
)
-if platform.system() == "Darwin" or "BSD" in platform.system():
+if platform.system() == "Darwin" or "BSD" in platform.system() or "Haiku" in platform.system():
# BSD derived systems use marginally different structures
# than either Linux or Windows.
--
2.37.3