diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..ceab6e1 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fea1633..2b1adc6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,9 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + [project] name = "pyappengine" -version = "0.1" authors = [ { name="François Dausseur", email="fdausseur@free.fr" }, ] @@ -15,5 +18,10 @@ classifiers = [ dependencies = [ "systemd-python", ] +dynamic = ["version"] + [project.urls] "Homepage" = "https://git.beafrancois.fr/Foue/pyappengine" + +[tool.setuptools.dynamic] +version = {file = ["VERSION"]} \ No newline at end of file diff --git a/src/appengine/__init__.py b/src/appengine/__init__.py index acf5f18..61b0b31 100644 --- a/src/appengine/__init__.py +++ b/src/appengine/__init__.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import os +import sys import traceback from configparser import ConfigParser import logging @@ -204,6 +205,7 @@ class CommandsLoader: def __init__(self, config: ConfigParser, log: logging.Handler, modpath: str): self.config = config self.modpath = modpath + sys.path.append(os.path.join(modpath)) Commands.defmod = self.config["general"].get("default") precmd = self.config["general"].get("methods_prefix") if not precmd is None: @@ -242,7 +244,11 @@ class CommandsLoader: self.cmods = cmds def _load_module(self, name: str): - module = import_module(name) + try: + module = import_module(name) + except ModuleNotFoundError: + raise Exception(f"""The module "{name}" could not be loaded.""") + members = inspect.getmembers(module, inspect.isclass) conf = None if name[len(self.precmds):] in self.config.sections():