diff --git a/scripts/helpers/integration_path.py b/scripts/helpers/integration_path.py index edeb8b3337..9b7f06756f 100644 --- a/scripts/helpers/integration_path.py +++ b/scripts/helpers/integration_path.py @@ -1,11 +1,20 @@ -import json import os from glob import glob def get_integration_path(): + base = "/tmp/repositories/addition" + # Per the publishing docs, an integration lives in + # ROOT/custom_components/. Scope the search there when the + # directory exists so repositories that also ship other manifest.json + # files (add-ons, test fixtures) resolve to the integration; fall back + # to the whole clone for content_in_root repositories. + search_root = os.path.join(base, "custom_components") + if not os.path.isdir(search_root): + search_root = base + files = [] - for dir, _, _ in os.walk("/tmp/repositories/addition"): + for dir, _, _ in os.walk(search_root): files.extend(glob(os.path.join(dir, "*manifest.json"))) if len(files) != 1: