50 lines
1.6 KiB
Bash
50 lines
1.6 KiB
Bash
# Template file for 'python-iwlib'
|
|
pkgname=python-iwlib
|
|
version=1.5
|
|
revision=1
|
|
wrksrc="${pkgname/python-//}-${version}"
|
|
build_style=python-module
|
|
hostmakedepends="python-setuptools python3-setuptools"
|
|
makedepends="python-devel python3-devel wireless_tools-devel"
|
|
depends="python wireless_tools"
|
|
short_desc="Iwlib library for Python2, for interacting with wireless devices"
|
|
maintainer="maxice8 <thinkabit.ukim@gmail.com>"
|
|
license="GPL-2"
|
|
homepage="https://github.com/nathan-hoad/python-iwlib"
|
|
distfiles="${PYPI_SITE}/i/iwlib/iwlib-${version}.tar.gz"
|
|
checksum=a58dd0da8b03bbd9c91fa0f9e7818362280bf0b7133bae0027f15581ee2e4751
|
|
pycompile_module="iwlib"
|
|
|
|
do_check() {
|
|
python3 test/test_imports.py
|
|
python2 test/test_imports.py
|
|
|
|
# The test tries to scan a interface but hardcodees 'wlan0' which is not always the name
|
|
# so we query /proc/net/wireless and get the WiFi interface and replace the file in the test
|
|
_wirelessinterface="$(cat /proc/net/wireless | grep : | cut -d: -f1)"
|
|
|
|
if [ -z "${_wirelessinterface}" ]; then
|
|
echo "no wifi interface found for test.py, ignoring the tests"
|
|
return
|
|
fi
|
|
|
|
sed -i "s|wlan0|${_wirelessinterface}|g" test/test.py
|
|
|
|
PYTHONPATH="${PWD}/build-2.7/lib.linux-${XBPS_TARGET_MACHINE}-2.7" python2 test/test.py
|
|
|
|
# The test uses python2 print statement so we edit it
|
|
sed -i "s|print|print(|g" test/test.py
|
|
sed -i '/print(/s/$/ )/' test/test.py
|
|
|
|
PYTHONPATH="${PWD}/build-3.6/lib.linux-${XBPS_TARGET_MACHINE}-3.6" python3 test/test.py
|
|
}
|
|
|
|
python3-iwlib_package() {
|
|
pycompile_module="iwlib"
|
|
depends="python3 wireless_tools"
|
|
short_desc="${short_desc/Python2/Python3}"
|
|
pkg_install() {
|
|
vmove usr/lib/python3*
|
|
}
|
|
}
|