CI: common.py: add cache (MR 1321)

Don't query the pmaports dir more than once. This cache will also be
used to store the upstream branch in the next commit.
This commit is contained in:
Oliver Smith 2020-06-16 19:12:52 +02:00 committed by Bart Ribbers
parent b89fc77d7c
commit 4d116177ac
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61

View file

@ -9,8 +9,16 @@ import subprocess
import sys
cache = {}
def get_pmaports_dir():
return os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
global cache
if "pmaports_dir" in cache:
return cache["pmaports_dir"]
ret = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
cache["pmaports_dir"] = ret
return ret
def run_git(parameters, check=True, stderr=None):