From 90cecb514e5044bcc7a7a5ddd4b3aa7a0ed198eb Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 12 Dec 2023 13:50:30 -0500 Subject: [PATCH] add resources symlink this allows editable installs to find asdf_standard.resources during an editable install (via importlib.resources.files) --- src/asdf_standard/integration.py | 9 +-------- src/asdf_standard/resources | 1 + 2 files changed, 2 insertions(+), 8 deletions(-) create mode 120000 src/asdf_standard/resources diff --git a/src/asdf_standard/integration.py b/src/asdf_standard/integration.py index 8981fe56..2d94dcc0 100644 --- a/src/asdf_standard/integration.py +++ b/src/asdf_standard/integration.py @@ -1,5 +1,4 @@ import sys -from pathlib import Path if sys.version_info < (3, 9): import importlib_resources @@ -10,13 +9,7 @@ def get_resource_mappings(): - resources_root = importlib_resources.files(asdf_standard) / "resources" - if not resources_root.is_dir(): - # In an editable install, the resources directory will exist off the - # repository root: - resources_root = Path(__file__).absolute().parent.parent.parent / "resources" - if not resources_root.is_dir(): - raise RuntimeError("Missing resources directory") + resources_root = importlib_resources.files("asdf_standard.resources") return [ asdf_standard.DirectoryResourceMapping( diff --git a/src/asdf_standard/resources b/src/asdf_standard/resources new file mode 120000 index 00000000..bc764151 --- /dev/null +++ b/src/asdf_standard/resources @@ -0,0 +1 @@ +../../resources \ No newline at end of file