diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 22ff6c4..7f8383c 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -12,6 +12,7 @@ jobs: strategy: matrix: python-version: + - '3.8' - '3.10' - '3.11' - '3.12' diff --git a/src/robot_folders/helpers/config_helpers.py b/src/robot_folders/helpers/config_helpers.py index 7bc0602..5d33fb8 100644 --- a/src/robot_folders/helpers/config_helpers.py +++ b/src/robot_folders/helpers/config_helpers.py @@ -23,16 +23,25 @@ from __future__ import print_function import os import shutil +import sys import yaml from importlib import resources +import robot_folders.helpers.resources + XDG_CONFIG_HOME = os.getenv( "XDG_CONFIG_HOME", os.path.expandvars(os.path.join("$HOME", ".config")) ) FILENAME_USERCONFIG = os.path.join(XDG_CONFIG_HOME, "robot_folders.yaml") +def get_resource_path(filename): + if sys.version_info.major == 3 and sys.version_info.minor < 9: + return resources.path(".".join([__package__, "resources"]), filename) + return resources.files(robot_folders.helpers.resources).joinpath(filename) + + class Userconfig(object): """Class for managing a userconfig""" @@ -43,9 +52,7 @@ class Userconfig(object): @classmethod def init_class(cls): """Load the distribution config file""" - with resources.path( - ".".join([__package__, "resources"]), "userconfig_distribute.yaml" - ) as p: + with get_resource_path("userconfig_distribute.yaml") as p: filename_distribute = p.as_posix() file_content = p.read_text() try: