diff --git a/cmdeploy/src/cmdeploy/tests/test_helpers.py b/cmdeploy/src/cmdeploy/tests/test_helpers.py index 58b3886b..715477b2 100644 --- a/cmdeploy/src/cmdeploy/tests/test_helpers.py +++ b/cmdeploy/src/cmdeploy/tests/test_helpers.py @@ -1,11 +1,10 @@ -import importlib.resources +from pathlib import Path from cmdeploy.www import build_webpages def test_build_webpages(tmp_path, make_config): - pkgroot = importlib.resources.files("cmdeploy") - src_dir = pkgroot.joinpath("../../../www/src").resolve() + src_dir = (Path(__file__).resolve() / "../../../../../www/src").resolve() assert src_dir.exists(), src_dir config = make_config("chat.example.org") build_dir = tmp_path.joinpath("build") diff --git a/cmdeploy/src/cmdeploy/www.py b/cmdeploy/src/cmdeploy/www.py index e0b3a3c8..9b543c6e 100644 --- a/cmdeploy/src/cmdeploy/www.py +++ b/cmdeploy/src/cmdeploy/www.py @@ -1,5 +1,4 @@ import hashlib -import importlib.resources import re import time import traceback @@ -37,7 +36,7 @@ def prepare_template(source): def get_paths(config) -> (Path, Path, Path): - reporoot = importlib.resources.files(__package__).joinpath("../../../").resolve() + reporoot = (Path(__file__).resolve() / "../../../../").resolve() www_path = Path(config.www_folder) # if www_folder was not set, use default directory if config.www_folder == "": @@ -133,8 +132,7 @@ def find_merge_conflict(src_dir) -> Path: def main(): - path = importlib.resources.files(__package__) - reporoot = path.joinpath("../../../").resolve() + reporoot = (Path(__file__).resolve() / "../../../../").resolve() inipath = reporoot.joinpath("chatmail.ini") config = read_config(inipath) config.webdev = True