Load the host modules when the registry reads ats.py by path without the repo root on sys.path
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f04c10e9e
commit
4fb06191cf
4 files changed
+38
-7
No files matched your search
+12
-1
@@ -33,10 +33,12 @@ import ipaddress
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
from collections.abc import Callable, Iterator, MutableMapping
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from typing import Any
|
||||
from pathlib import Path
|
||||
from urllib.parse import unquote
|
||||
|
||||
import httpx
|
||||
@@ -46,7 +48,16 @@ from desk.sources import (
|
||||
SummaryPolicy, TaggingPolicy, TargetSpec, Tasks, USER_AGENT,
|
||||
)
|
||||
|
||||
from plugins import atshosts
|
||||
try:
|
||||
from plugins import atshosts
|
||||
except ModuleNotFoundError:
|
||||
# `desk.sources.registry` loads this file by its path, under a name of its
|
||||
# own, and the app puts the repo root on `sys.path` before it does; a
|
||||
# registry run without the app (a script, another working directory)
|
||||
# does not, and the host modules are found as the package beside this
|
||||
# file. So the root goes on the path then, and only then.
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
from plugins import atshosts
|
||||
from plugins.atshosts._shared import Get, Row
|
||||
|
||||
# The names the parsers had here before they moved to their host modules,
|
||||
|
||||
Reference in new issue
Block a user