Use https by default
[gentoo.git] / net-misc / wicd / wicd-1.7.2.4-r3.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="ncurses?,xml"
9
10 inherit eutils distutils-r1 linux-info readme.gentoo systemd
11
12 DESCRIPTION="A lightweight wired and wireless network manager for Linux"
13 HOMEPAGE="https://launchpad.net/wicd"
14 SRC_URI="http://launchpad.net/wicd/1.7/${PV}/+download/${P}.tar.gz
15         mac4lin? ( https://dev.gentoo.org/~anarchy/dist/wicd-mac4lin-icons.tar.xz )
16         ambiance? ( http://freetimesblog.altervista.org/blog/wp-content/uploads/downloads/2010/05/Icone-Wicd-Lucid.tar.gz )"
17
18 LICENSE="GPL-2"
19 SLOT="0"
20 KEYWORDS="amd64 ~arm ~mips ppc ppc64 x86"
21 IUSE="doc X ambiance +gtk ioctl libnotify mac4lin ncurses nls +pm-utils"
22
23 DEPEND="nls? ( dev-python/Babel )"
24 RDEPEND="${PYTHON_DEPS}
25         dev-python/dbus-python[${PYTHON_USEDEP}]
26         X? (
27                 gtk? ( dev-python/pygtk )
28                 || (
29                         x11-misc/ktsuss
30                         x11-libs/gksu
31                         kde-apps/kdesu
32                         )
33         )
34         || (
35                 net-misc/dhcpcd
36                 net-misc/dhcp
37                 net-misc/pump
38         )
39         net-wireless/wireless-tools
40         net-wireless/wpa_supplicant
41         || (
42                 sys-apps/net-tools
43                 sys-apps/ethtool
44         )
45         !gtk? ( dev-python/pygobject:2[${PYTHON_USEDEP}] )
46         ioctl? ( dev-python/python-iwscan dev-python/python-wpactrl )
47         libnotify? ( dev-python/notify-python[${PYTHON_USEDEP}] )
48         ncurses? (
49                 dev-python/urwid
50                 dev-python/pygobject:2[${PYTHON_USEDEP}]
51         )
52         pm-utils? ( sys-power/pm-utils )
53         "
54
55 src_prepare() {
56         CONFIG_CHECK="~CFG80211_WEXT"
57         local WARNING_CFG80211_WEXT="Wireless extensions have not been \
58         configured in your kernel.  Wicd will not work unless CFG80211_WEXT is set."
59         check_extra_config
60
61         # Fix bug 441966 (urwid-1.1.0 compatibility)
62         epatch "${FILESDIR}"/${P}-urwid.patch
63         epatch "${FILESDIR}"/${P}-second-urwid.patch
64         epatch "${FILESDIR}"/${PN}-1.7.1_beta2-init.patch
65         epatch "${FILESDIR}"/${PN}-init-sve-start.patch
66         # Add a template for hex psk's and wpa (Bug 306423)
67         epatch "${FILESDIR}"/${PN}-1.7.1_pre20111210-wpa-psk-hex-template.patch
68         # The Categories entry in the .desktop files is outdated
69         epatch "${FILESDIR}"/${P}-fix-desktop-categories.patch
70         # Fix bug 416579 (should be included in next release)
71         epatch "${FILESDIR}"/${P}-fix-dbus-error.patch
72         # get rid of opts variable to fix bug 381885
73         sed -i "/opts/d" "in/init=gentoo=wicd.in" || die
74         # Make init script provide net per bug 405775
75         epatch "${FILESDIR}"/${PN}-1.7.1-provide-net.patch
76         # Need to ensure that generated scripts use Python 2 at run time.
77         sed -e "s:self.python = '/usr/bin/python':self.python = '/usr/bin/python2':" \
78           -i setup.py || die "sed failed"
79         # Fix misc helper scripts:
80         sed -e "s:/usr/bin/env python:/usr/bin/env python2:" \
81                 -i wicd/suspend.py wicd/autoconnect.py wicd/monitor.py
82         if use nls; then
83           # Asturian is faulty with PyBabel
84           # (https://bugs.launchpad.net/wicd/+bug/928589)
85           rm po/ast.po
86           # zh_CN fails with newer PyBabel (Aug 2013)
87           rm po/zh_CN.po
88         else
89           # nuke translations
90           rm po/*.po
91         fi
92
93         DOC_CONTENTS="To start wicd at boot with openRC, add
94                 /etc/init.d/wicd to a runlevel and: (1) Remove all net.*
95                 initscripts (except for net.lo) from all runlevels (2) Add these
96                 scripts to the RC_PLUG_SERVICES line in /etc/rc.conf (For
97                 example, rc_hotplug=\"!net.eth* !net.wlan*\")"
98 }
99
100 src_configure() {
101         local myconf
102         use gtk || myconf="${myconf} --no-install-gtk"
103         use libnotify || myconf="${myconf} --no-use-notifications"
104         use ncurses || myconf="${myconf} --no-install-ncurses"
105         use pm-utils || myconf="${myconf} --no-install-pmutils"
106         python_export_best
107         "${EPYTHON}" ./setup.py configure --no-install-docs \
108                 --resume=/usr/share/wicd/scripts/ \
109                 --suspend=/usr/share/wicd/scripts/ \
110                 --verbose ${myconf}
111 }
112
113 src_install() {
114         distutils-r1_src_install
115         keepdir /var/lib/wicd/configurations
116         keepdir /etc/wicd/scripts/{postconnect,disconnect,preconnect}
117         keepdir /var/log/wicd
118         use nls || rm -rf "${D}"/usr/share/locale
119         systemd_dounit "${S}/other/wicd.service"
120
121         if use mac4lin; then
122                 rm -rf "${D}"/usr/share/pixmaps/wicd || die "Failed to remove old icons"
123                 mv "${WORKDIR}"/wicd "${D}"/usr/share/pixmaps/
124         fi
125         if use ambiance; then
126                 # Overwrite tray icons with ambiance icon
127                 rm "${WORKDIR}/Icone Wicd Lucid"/signal*
128                 cp "${WORKDIR}/Icone Wicd Lucid"/*.png "${D}"/usr/share/pixmaps/wicd/
129         fi
130         readme.gentoo_src_install
131 }
132
133 pkg_postinst() {
134         # Maintainer's note: the consolekit use flag short circuits a dbus rule and
135         # allows the connection. Else, you need to be in the group.
136         if ! has_version sys-auth/consolekit; then
137                 ewarn "Wicd-1.6 and newer requires your user to be in the 'users' group. If"
138                 ewarn "you are not in that group, then modify /etc/dbus-1/system.d/wicd.conf"
139         fi
140
141         readme.gentoo_print_elog
142 }