ci: allow specifying pmbootstrap path to aid running locally (MR 4994)

I don't like how CI requires pmbootstrap in PATH to be a symlink, I use
a wrapper script to handle running pmbootstrap how I want and the
current pmbootstrap path detection is kinda annoying since it depends on
it being a symlink.

This allows using an environment variable, PMBOOTSTRAP_PATH, to set the
pmbootstrap path and skip all of the symlink resolving stuff.
This commit is contained in:
Clayton Craft 2024-04-12 15:18:51 -07:00
parent 07812a9189
commit 40a46fd4e5
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A

View file

@ -15,6 +15,13 @@ def path_pmbootstrap():
code from there.
returns: pmbootstrap installation folder
"""
if path:= os.environ.get("PMBOOTSTRAP_PATH"):
if os.path.exists(path):
return path
else:
print("WARNING: PMBOOTSTRAP_PATH is invalid, trying to detect correct path...")
# This variable is set by pmbootstrap 1.52 and later
# If it's undefined, try to find 'pmbootstrap' in path
bin = os.environ.get("PMBOOTSTRAP_CMD") or shutil.which("pmbootstrap")