mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-13 23:30:04 +02:00
ifaddr: update to version 0.2.0. Add Haiku support. (#9452)
Not sure this ever worked before. Seems to work well enough now.
This commit is contained in:
@@ -1,76 +0,0 @@
|
||||
SUMMARY="Enumerate network interfaces/adapters and their IP addresses"
|
||||
DESCRIPTION="ifaddr is a small Python library that allows you to find all \
|
||||
the IP addresses of the computer."
|
||||
HOMEPAGE="https://github.com/pydron/ifaddr/"
|
||||
COPYRIGHT="2014 Stefan C. Mueller"
|
||||
LICENSE="MIT"
|
||||
REVISION="3"
|
||||
SOURCE_URI="https://github.com/pydron/ifaddr/archive/$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="e72a677a66411bfd2ca2157f8adbf27ad59ed36f6185365b263d7bb475a6240c"
|
||||
SOURCE_FILENAME="ifaddr-$portVersion.tar.gz"
|
||||
|
||||
ARCHITECTURES="any"
|
||||
|
||||
PROVIDES="
|
||||
$portName = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
"
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
"
|
||||
|
||||
PYTHON_PACKAGES=(python39)
|
||||
PYTHON_VERSIONS=(3.9)
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
||||
pythonVersion=${PYTHON_VERSIONS[i]}
|
||||
eval "PROVIDES_$pythonPackage=\"
|
||||
${portName}_$pythonPackage = $portVersion
|
||||
\""
|
||||
eval "REQUIRES_$pythonPackage=\"
|
||||
haiku
|
||||
cmd:python$pythonVersion
|
||||
\""
|
||||
BUILD_REQUIRES="$BUILD_REQUIRES
|
||||
setuptools_$pythonPackage
|
||||
"
|
||||
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
|
||||
cmd:python$pythonVersion"
|
||||
done
|
||||
|
||||
BUILD()
|
||||
{
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
||||
pythonVersion=${PYTHON_VERSIONS[i]}
|
||||
|
||||
rm -rf "$sourceDir"-$pythonPackage
|
||||
cp -a "$sourceDir" "$sourceDir"-$pythonPackage
|
||||
cd "$sourceDir"-$pythonPackage
|
||||
|
||||
python=python$pythonVersion
|
||||
$python setup.py build
|
||||
done
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
||||
pythonVersion=${PYTHON_VERSIONS[i]}
|
||||
|
||||
cd "$sourceDir"-$pythonPackage
|
||||
|
||||
python=python$pythonVersion
|
||||
installLocation=$prefix/lib/$python/vendor-packages
|
||||
export PYTHONPATH=$installLocation
|
||||
mkdir -p "$installLocation"
|
||||
$python setup.py install \
|
||||
--root=/ --prefix="$prefix" --skip-build
|
||||
|
||||
packageEntries $pythonPackage \
|
||||
"$prefix"/lib/$python
|
||||
done
|
||||
}
|
||||
64
dev-python/ifaddr/ifaddr-0.2.0.recipe
Normal file
64
dev-python/ifaddr/ifaddr-0.2.0.recipe
Normal file
@@ -0,0 +1,64 @@
|
||||
SUMMARY="Cross-platform network interface and IP address enumeration library"
|
||||
DESCRIPTION="ifaddr is a small Python library that allows you to find all \
|
||||
the IP addresses of the computer."
|
||||
HOMEPAGE="https://github.com/pydron/ifaddr/"
|
||||
COPYRIGHT="2014 Stefan C. Mueller"
|
||||
LICENSE="MIT"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/pydron/ifaddr/archive/$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="bc70dbcad66c25c8c13e037585b43765c1ea82da629708b13de542cb9872c0c7"
|
||||
PATCHES="ifaddr-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="any"
|
||||
|
||||
PROVIDES="
|
||||
$portName = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
"
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
"
|
||||
|
||||
PYTHON_PACKAGES=(python39 python310)
|
||||
PYTHON_VERSIONS=(3.9 3.10)
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
||||
pythonVersion=${PYTHON_VERSIONS[i]}
|
||||
|
||||
eval "PROVIDES_$pythonPackage=\"
|
||||
${portName}_$pythonPackage = $portVersion
|
||||
\""
|
||||
eval "REQUIRES_$pythonPackage=\"
|
||||
haiku
|
||||
cmd:python$pythonVersion
|
||||
\""
|
||||
BUILD_REQUIRES+="
|
||||
setuptools_$pythonPackage
|
||||
"
|
||||
BUILD_PREREQUIRES+="
|
||||
cmd:python$pythonVersion
|
||||
"
|
||||
done
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
|
||||
python=python$pythonVersion
|
||||
installLocation=$prefix/lib/$python/vendor-packages/
|
||||
export PYTHONPATH=$installLocation:$PYTHONPATH
|
||||
|
||||
mkdir -p $installLocation
|
||||
rm -rf build
|
||||
|
||||
$python setup.py build install \
|
||||
--root=/ --prefix=$prefix
|
||||
|
||||
packageEntries $pythonPackage \
|
||||
$prefix/lib/python*
|
||||
done
|
||||
}
|
||||
51
dev-python/ifaddr/patches/ifaddr-0.2.0.patchset
Normal file
51
dev-python/ifaddr/patches/ifaddr-0.2.0.patchset
Normal file
@@ -0,0 +1,51 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user