# Template file for 'wicd'
pkgname=wicd
version=1.7.4
revision=6
hostmakedepends="python python-setuptools python-Babel"
depends="dbus-glib dhclient ethtool net-tools python-dbus python-gobject2 python-urwid
 util-linux wireless_tools wpa_supplicant"
conf_files="
	/etc/dbus-1/system.d/wicd.conf
	/etc/wicd/encryption/templates/active"
short_desc="Open source wired and wireless network manager"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only"
homepage="http://wicd.sourceforge.net"
distfiles="http://launchpad.net/wicd/1.7/${version}/+download/wicd-${version}.tar.gz"
checksum=67989614004773db349791c37675efb914d084bdb221356a05e4369c35e7eb62
python_version=2

do_build() {
	python2 setup.py configure --verbose --no-install-init \
		--resume=/usr/share/wicd/scripts \
		--suspend=/usr/share/wicd/scripts \
		--python=/usr/bin/python2 --lib=/usr/lib \
		--sbin=/usr/bin --distro=arch \
		--no-install-gnome-shell-extensions \
		--wicdgroup=network
}
do_install() {
	python2 setup.py install --root=${DESTDIR}

	vinstall other/wicd.desktop 644 usr/share/applications
	vinstall other/wicd-tray.desktop 644 usr/share/applications

	# Copy configuration to force use of dhclient.
	vinstall ${FILESDIR}/manager-settings.conf 755 etc/wicd

	vmkdir usr/lib/wicd
	vcopy "build/lib/wicd/*.py" usr/lib/wicd
	chmod 755 ${DESTDIR}/usr/lib/wicd/*.py
	vsv wicd

	rm -rf ${DESTDIR}/lib
	rm -rf ${DESTDIR}/usr/share/doc
	rm -rf ${DESTDIR}/etc/logrotate.d
	rm -rf ${DESTDIR}/usr/lib/pm-utils
}

wicd-gtk_package() {
	depends="wicd>=${version} pygtk python-notify shared-mime-info desktop-file-utils hicolor-icon-theme"
	short_desc+=" - GTK UI"
	pycompile_dirs="usr/share/wicd/gtk"
	pkg_install() {
		vmove etc/xdg
		vmove usr/bin/wicd-client
		vmove usr/bin/wicd-gtk
		vmove usr/share/applications
		vmove usr/share/pixmaps
		vmove usr/share/icons
		vmove usr/share/wicd/icons
		vmove usr/share/wicd/gtk
		vmove usr/share/man/man1/wicd-client.1
		vmove usr/share/man/nl/man1/wicd-client.1
	}
}
