Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/murfey/client/contexts/spa_metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from importlib.metadata import entry_points
from pathlib import Path
from typing import Dict, Optional

Expand Down Expand Up @@ -346,3 +347,28 @@ def post_transfer_epu(
},
)
self._registered_squares.add(gs_name)

elif (
transferred_file.suffix == ".xml"
and transferred_file.name.startswith("GridSquare")
and environment
):
source = _get_source(transferred_file, environment=environment)
if not source:
logger.warning(
f"Source could not be identified for {str(transferred_file)}"
)
return

gridsquare_dm = source / "Metadata" / f"{transferred_file.parent.name}.dm"
for h in entry_points(group="murfey.hooks"):
try:
if h.name == "get_gridsquare_dm":
h.load()(
destination_dir=source,
gridsquare_dm=gridsquare_dm,
environment=environment,
token=self._token,
)
except Exception as e:
logger.warning(f"Get GridSquare dm hook failed: {e}")