Fix custom pmaports dir (pmbootstrap --args) (MR 2342)

The aports argument is a list of paths now, so iterate over each of them
when checking if they exist.

Fix for:
INFO:root:ERROR: 'list' object has no attribute 'exists'
This commit is contained in:
Oliver Smith 2024-07-01 22:22:08 +02:00
parent 6915c6a17b
commit 91aee0b34c
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -54,10 +54,13 @@ def init(args: PmbArgs) -> PmbArgs:
# sys.exit(0)
config = pmb.config.load(args.config)
if args.aports and not args.aports.exists():
raise ValueError(
"pmaports path (specified with --aports) does" f" not exist: {args.aports}"
)
if args.aports:
for pmaports_dir in args.aports:
if pmaports_dir.exists():
continue
raise ValueError(
f"pmaports path (specified with --aports) does not exist: {pmaports_dir}"
)
# Override config at runtime with command line arguments
for key, _ in vars(config).items():