From 350d08312267770e4f13dbf732bcb019214ba3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sat, 10 Feb 2024 15:13:45 +0100 Subject: [PATCH] Add sys.path.insert to import appslib --- autoupdate_app_sources/autoupdate_app_sources.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/autoupdate_app_sources/autoupdate_app_sources.py b/autoupdate_app_sources/autoupdate_app_sources.py index 0d41404..ad7f2d1 100644 --- a/autoupdate_app_sources/autoupdate_app_sources.py +++ b/autoupdate_app_sources/autoupdate_app_sources.py @@ -4,7 +4,6 @@ import argparse import glob import hashlib import os -import subprocess import re import sys import time @@ -13,10 +12,12 @@ from datetime import datetime import requests import toml -from rest_api import GithubAPI, GitlabAPI, GiteaForgejoAPI, RefType -REPO_APPS_ROOT = Path(subprocess.check_output([ - "git", "-C", Path(__file__).parent, "rev-parse", "--show-toplevel"]).decode("utf-8").strip()) +# add apps/tools to sys.path +sys.path.insert(0, str(Path(__file__).parent.parent)) + +from rest_api import GithubAPI, GitlabAPI, GiteaForgejoAPI, RefType +from appslib.utils import REPO_APPS_ROOT, get_catalog # pylint: disable=import-error STRATEGIES = [ @@ -43,11 +44,9 @@ author = None def apps_to_run_auto_update_for(): - catalog = toml.load(open(os.path.dirname(__file__) + "/../../apps.toml")) - apps_flagged_as_working_and_on_yunohost_apps_org = [ app - for app, infos in catalog.items() + for app, infos in get_catalog().items() if infos["state"] == "working" and "/github.com/yunohost-apps" in infos["url"].lower() ]