Fix imporlib.resources deprecation warning
This commit is contained in:
parent
bc534e923c
commit
3ab5be6a27
2 changed files with 6 additions and 2 deletions
|
|
@ -183,7 +183,9 @@ def _get_kubefiles_path(kubefiles_path: Path | None) -> Generator[Path, None, No
|
|||
if kubefiles_path:
|
||||
yield kubefiles_path
|
||||
else:
|
||||
with resources.path(__package__, "kubefiles") as default_kubefiles_path:
|
||||
with resources.as_file(
|
||||
resources.files(__package__).joinpath("kubefiles")
|
||||
) as default_kubefiles_path:
|
||||
yield default_kubefiles_path
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ def mount(app: FastAPI) -> None:
|
|||
directory, which is then mounted under the /webui route.
|
||||
"""
|
||||
webui_path = Path(__file__).parent / "webui"
|
||||
with resources.path("runboat", "webui-templates") as webui_template_path:
|
||||
with resources.as_file(
|
||||
resources.files(__package__).joinpath("webui-templates")
|
||||
) as webui_template_path:
|
||||
for path in webui_template_path.iterdir():
|
||||
if path.name.endswith(".jinja"):
|
||||
template = jinja2.Template(path.read_text())
|
||||
|
|
|
|||
Loading…
Reference in a new issue