Fix names of standalone pkgs

This commit is contained in:
Reid 'arrdem' McKenzie 2022-10-17 11:13:12 -06:00
parent e5b23aa480
commit 97e5975297

View file

@ -119,13 +119,19 @@ def load_profile(root, name):
def load_packages(root: Path, roots) -> dict:
"""Load the configured packages."""
def _load_package(p):
name = str(p.relative_to(root)).replace(".toml", "")
try:
packages[name] = load_package(p, name)
except Exception as e:
log.exception(f"Unable to load {p} due to exception")
packages = {}
for r in roots.get("package", []):
r = root / expandvars(r)
log.debug(f"Trying to load packages from {r}...")
for p in r.glob("*"):
name = str(p.relative_to(root))
packages[name] = load_package(p, name)
_load_package(p)
for r in roots.get("profile", []):
# Add profiles, hosts which contain subpackages.
@ -133,11 +139,10 @@ def load_packages(root: Path, roots) -> dict:
log.debug(f"Trying to load profiles from {r}...")
for mp_root in r.glob("*"):
# First find all subpackages
log.debug(f"Trying to load packages from {mp_root}...")
log.debug(f"Trying to load subpackages from {mp_root}...")
for p in mp_root.glob("*"):
if p.is_dir():
name = str(p.relative_to(root))
packages[name] = load_package(p, name)
if (p.is_dir() or (p.is_file() and p.suffix in ['.toml'])):
_load_package(p)
# Register the metapackages themselves using the profile type
mp_name = str(mp_root.relative_to(root))