diff --git a/alibuild_helpers/cmd.py b/alibuild_helpers/cmd.py index a0ea2db5..4f411f4a 100644 --- a/alibuild_helpers/cmd.py +++ b/alibuild_helpers/cmd.py @@ -54,9 +54,10 @@ def getstatusoutput(command, timeout=None): return proc.returncode, merged_output -def execute(command, printer=debug, timeout=None): +def execute(command: str | list[str], printer=debug, timeout:int | None =None) -> int: popen = Popen(command, shell=isinstance(command, str), stdout=PIPE, stderr=STDOUT) start_time = time.time() + assert popen.stdout is not None, "Could not open stdout for command" for line in iter(popen.stdout.readline, b""): printer("%s", decode_with_fallback(line).strip("\n")) if timeout is not None and time.time() > start_time + timeout: diff --git a/alibuild_helpers/doctor.py b/alibuild_helpers/doctor.py index 8c0fa42c..8fa29030 100644 --- a/alibuild_helpers/doctor.py +++ b/alibuild_helpers/doctor.py @@ -7,7 +7,7 @@ from alibuild_helpers.utilities import getPackageList, parseDefaults, readDefaults, validateDefaults from alibuild_helpers.cmd import getstatusoutput, DockerRunner -def prunePaths(workDir): +def prunePaths(workDir: str) -> None: for x in ["PATH", "LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"]: if not x in os.environ: continue @@ -52,7 +52,7 @@ def checkRequirements(spec, cmd, homebrew_replacement, getstatusoutput_docker): spec.get("system_requirement_missing")) return (err, "") -def systemInfo(): +def systemInfo() -> None: _,out = getstatusoutput("env") debug("Environment:\n%s", out) _,out = getstatusoutput("uname -a") diff --git a/alibuild_helpers/init.py b/alibuild_helpers/init.py index ad93b116..5016baf4 100644 --- a/alibuild_helpers/init.py +++ b/alibuild_helpers/init.py @@ -8,7 +8,7 @@ import os.path as path import os, sys -def parsePackagesDefinition(pkgname): +def parsePackagesDefinition(pkgname: str): return [ dict(zip(["name","ver"], y.split("@")[0:2])) for y in [ x+"@" for x in list(filter(lambda y: y, pkgname.split(","))) ] ]