[general] Add Python3 support

* Change some formatting to please python3
* remote pyroute2 dependency, for which I didn't find a python3 module
  in Fedora24

this solves #1
This commit is contained in:
Tobias Witek 2016-11-05 16:33:35 +01:00
parent caceb6f20f
commit 4e0e3ef427
7 changed files with 16 additions and 22 deletions

View file

@ -1,4 +1,3 @@
import pyroute2
import netifaces
import bumblebee.module
@ -39,14 +38,9 @@ class Module(bumblebee.module.Module):
return result
def _iswlan(self, intf):
iw = pyroute2.IW()
ip = pyroute2.IPRoute()
idx = ip.link_lookup(ifname=intf)[0]
try:
iw.get_interface_by_ifindex(idx)
return True
except Exception as e:
return False
# wifi, wlan, wlp, seems to work for me
if intf.startswith("w"): return True
return False
def _istunnel(self, intf):
return intf.startswith("tun")