mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-21 20:30:42 +00:00
fix: pkg_resources with importlib.resources (#766)
This commit is contained in:
parent
ce0d895fc4
commit
48baa2f338
@ -1,5 +1,6 @@
|
|||||||
"""Global settings object definition."""
|
"""Global settings object definition."""
|
||||||
|
|
||||||
|
import importlib.resources
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import anyconfig
|
import anyconfig
|
||||||
@ -7,7 +8,6 @@ import jsonschema.exceptions
|
|||||||
import pathspec
|
import pathspec
|
||||||
from appdirs import AppDirs
|
from appdirs import AppDirs
|
||||||
from jsonschema._utils import format_as_index
|
from jsonschema._utils import format_as_index
|
||||||
from pkg_resources import resource_filename
|
|
||||||
|
|
||||||
from ansiblelater import utils
|
from ansiblelater import utils
|
||||||
|
|
||||||
@ -105,9 +105,9 @@ class Settings:
|
|||||||
defaults["ansible"]["custom_modules"].append(f)
|
defaults["ansible"]["custom_modules"].append(f)
|
||||||
|
|
||||||
if defaults["rules"]["builtin"]:
|
if defaults["rules"]["builtin"]:
|
||||||
defaults["rules"]["dir"].append(
|
ref = importlib.resources.files("ansiblelater") / "rules"
|
||||||
os.path.join(resource_filename("ansiblelater", "rules"))
|
with importlib.resources.as_file(ref) as path:
|
||||||
)
|
defaults["rules"]["dir"].append(path)
|
||||||
|
|
||||||
defaults["rules"]["dir"] = [
|
defaults["rules"]["dir"] = [
|
||||||
os.path.relpath(os.path.normpath(p)) for p in defaults["rules"]["dir"]
|
os.path.relpath(os.path.normpath(p)) for p in defaults["rules"]["dir"]
|
||||||
|
Loading…
Reference in New Issue
Block a user