added type hints

This commit is contained in:
2021-05-26 17:46:33 +02:00
parent 65afb113ec
commit d019772eed

View File

@@ -105,7 +105,7 @@ def run_worker(todo: dict) -> None:
os.chdir(sys.path[0]) os.chdir(sys.path[0])
def do_repo_work(): def do_repo_work() -> None:
for repo in d: for repo in d:
if d[repo]: if d[repo]:
logging.info("[REPO/%s] Adding %s", repo, ", ".join(d[repo])) logging.info("[REPO/%s] Adding %s", repo, ", ".join(d[repo]))
@@ -141,7 +141,7 @@ def already_running() -> bool:
return True return True
def find_all_files_for_pkg(name, repo) -> list: def find_all_files_for_pkg(name: str, repo: str) -> list:
searchpath = os.path.join(config["basedir"]["repo"], repo, "os", config["arch"]) + "/" + name + "-*.pkg.*" searchpath = os.path.join(config["basedir"]["repo"], repo, "os", config["arch"]) + "/" + name + "-*.pkg.*"
pkgs = glob.glob(searchpath) pkgs = glob.glob(searchpath)
@@ -152,7 +152,7 @@ def find_all_files_for_pkg(name, repo) -> list:
return pkgs return pkgs
def get_failed_packages(repo) -> list: def get_failed_packages(repo: str) -> list:
if os.path.exists(os.path.join(config["basedir"]["repo"], repo + "_failed.txt")): if os.path.exists(os.path.join(config["basedir"]["repo"], repo + "_failed.txt")):
with open(os.path.join(config["basedir"]["repo"], repo + "_failed.txt")) as p: with open(os.path.join(config["basedir"]["repo"], repo + "_failed.txt")) as p:
return p.read().splitlines() return p.read().splitlines()
@@ -160,7 +160,7 @@ def get_failed_packages(repo) -> list:
return [] return []
def setup_chroot(): def setup_chroot() -> None:
if not os.path.exists(os.path.join(config["basedir"]["chroot"], "root")): if not os.path.exists(os.path.join(config["basedir"]["chroot"], "root")):
pathlib.Path(config["basedir"]["chroot"]).mkdir(parents=True, exist_ok=True) pathlib.Path(config["basedir"]["chroot"]).mkdir(parents=True, exist_ok=True)
s = subprocess.run(["mkarchroot", "-C", "/usr/share/devtools/pacman-extra.conf", s = subprocess.run(["mkarchroot", "-C", "/usr/share/devtools/pacman-extra.conf",