diff --git a/aprsd/plugin.py b/aprsd/plugin.py index 03f47bb..170da73 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -1,7 +1,6 @@ # The base plugin class import abc import fnmatch -import imp import inspect import json import logging @@ -13,6 +12,7 @@ import time import pluggy import requests import six +from thesmuggler import smuggle from aprsd.fuzzyclock import fuzzy @@ -106,16 +106,10 @@ class PluginManager(object): for path, subdirs, files in os.walk(dir_path): for name in files: if fnmatch.fnmatch(name, pattern): - found_module = imp.find_module(name[:-3], [path]) - module = imp.load_module( - name, found_module[0], found_module[1], found_module[2] - ) + LOG.debug("MODULE? '{}' '{}'".format(name, path)) + module = smuggle("{}/{}".format(path, name)) for mem_name, obj in inspect.getmembers(module): - if ( - inspect.isclass(obj) - and inspect.getmodule(obj) is module - and self.is_plugin(obj) - ): + if inspect.isclass(obj) and self.is_plugin(obj): self.obj_list.append( {"name": mem_name, "obj": obj(self.config)} ) diff --git a/dev-requirements.in b/dev-requirements.in index dcd980a..2bcaa65 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -7,3 +7,4 @@ pep8-naming black isort Sphinx +thesmuggler diff --git a/dev-requirements.txt b/dev-requirements.txt index 1735889..5dc6d07 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -11,6 +11,7 @@ babel==2.9.0 # via sphinx black==20.8b1 # via -r dev-requirements.in certifi==2020.12.5 # via requests chardet==3.0.4 # via requests +click==7.1.2 # via black coverage==5.3 # via pytest-cov distlib==0.3.1 # via virtualenv docutils==0.16 # via sphinx @@ -26,17 +27,17 @@ markupsafe==1.1.1 # via jinja2 mccabe==0.6.1 # via flake8 mypy-extensions==0.4.3 # via black, mypy mypy==0.790 # via -r dev-requirements.in -packaging==20.7 # via pytest, sphinx, tox +packaging==20.8 # via pytest, sphinx, tox pathspec==0.8.1 # via black pep8-naming==0.11.1 # via -r dev-requirements.in pluggy==0.13.1 # via pytest, tox -py==1.9.0 # via pytest, tox +py==1.10.0 # via pytest, tox pycodestyle==2.6.0 # via flake8 pyflakes==2.2.0 # via flake8 pygments==2.7.3 # via sphinx pyparsing==2.4.7 # via packaging pytest-cov==2.10.1 # via -r dev-requirements.in -pytest==6.1.2 # via -r dev-requirements.in, pytest-cov +pytest==6.2.0 # via -r dev-requirements.in, pytest-cov pytz==2020.4 # via babel regex==2020.11.13 # via black requests==2.25.0 # via sphinx @@ -49,6 +50,7 @@ sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.4 # via sphinx +thesmuggler==1.0.1 # via -r dev-requirements.in toml==0.10.2 # via black, pytest, tox tox==3.20.1 # via -r dev-requirements.in typed-ast==1.4.1 # via black, mypy diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..05fe54c --- /dev/null +++ b/requirements.in @@ -0,0 +1,9 @@ +click +click-completion +imapclient +pluggy +pbr +pyyaml +six +requests +thesmuggler diff --git a/requirements.txt b/requirements.txt index 14be40c..e287b2b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,22 @@ -click -click-completion -imapclient -pluggy -pbr -pyyaml -six -requests +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile +# +certifi==2020.12.5 # via requests +chardet==3.0.4 # via requests +click-completion==0.5.2 # via -r requirements.in +click==7.1.2 # via -r requirements.in, click-completion +idna==2.10 # via requests +imapclient==2.1.0 # via -r requirements.in +jinja2==2.11.2 # via click-completion +markupsafe==1.1.1 # via jinja2 +pbr==5.5.1 # via -r requirements.in +pluggy==0.13.1 # via -r requirements.in +pyyaml==5.3.1 # via -r requirements.in +requests==2.25.0 # via -r requirements.in +shellingham==1.3.2 # via click-completion +six==1.15.0 # via -r requirements.in, click-completion, imapclient +thesmuggler==1.0.1 # via -r requirements.in +urllib3==1.26.2 # via requests