Skip to content
Open
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
13 changes: 11 additions & 2 deletions scripts/helpers/integration_path.py
Original file line number Diff line number Diff line change
@@ -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/<domain>. 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:
Expand Down
Loading