1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-11 16:54:12 +01:00

Fixed backend plugin loading.

This commit is contained in:
2020-08-31 21:14:54 +02:00
parent 0ef443f97c
commit 3992824e23
2 changed files with 7 additions and 7 deletions

View File

@@ -22,12 +22,16 @@ Manages and loads the pluggable backends for wicd.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import importlib
import os
import wicd.backends as bck
BACKENDS = {x.split('_')[1]: x for x in dir(bck) if not x.startswith('__')}
# TODO(gryf): change this, because it's ugly as hell
BACKENDS = {x.split('_')[1][:-3]: x[:-3] for x in
os.listdir(os.path.dirname(bck.__file__))
if not x.startswith('__')}
def fail(backend_name, reason):
@@ -98,7 +102,8 @@ class BackendManager(object):
"""
try:
backend = BACKENDS[backend_name]
backend = importlib.import_module('.' + BACKENDS[backend_name],
'wicd.backends')
except KeyError:
return None

View File

@@ -1,6 +1 @@
"""Backends module."""
from wicd.backends import be_external
from wicd.backends import be_ioctl
__all__ = ['be_external', 'be_ioctl']