From 78341e432c296db82d0a4c701286a419561a1f52 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Sat, 3 May 2025 18:02:01 -0400 Subject: [PATCH] Support mixing system aliases and names in the same command Signed-off-by: Ihar Hrachyshka --- README.md | 2 +- nixpkgs_review/review.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 49142508..810c7b70 100644 --- a/README.md +++ b/README.md @@ -355,7 +355,7 @@ since the architecture/operating system mismatches. By default, `nixpkgs-review` targets only the current system (`--systems current`). You can also explicitly provide one or several systems to target (`--systems "x86_64-linux aarch64-darwin"`). We also provide aliases for -the flag: +the flag, which can also be mixed with the system names. | Alias | Transforms to | | ---------------------------------------------------- | --------------------------------------------------------- | diff --git a/nixpkgs_review/review.py b/nixpkgs_review/review.py index 72f680ce..2010301e 100644 --- a/nixpkgs_review/review.py +++ b/nixpkgs_review/review.py @@ -1,6 +1,7 @@ import argparse import concurrent.futures import fcntl +import itertools import os import subprocess import sys @@ -133,16 +134,14 @@ def __init__( self.skip_packages = skip_packages self.skip_packages_regex = skip_packages_regex self.local_system = current_system() - match len(systems): - case 0: - msg = "Systems is empty" - raise NixpkgsReviewError(msg) - case 1: - self.systems = self._process_aliases_for_systems( - next(iter(systems)).lower() - ) - case _: - self.systems = set(systems) + if not systems: + msg = "Systems is empty" + raise NixpkgsReviewError(msg) + self.systems = set( + itertools.chain( + *[self._process_aliases_for_systems(s.lower()) for s in systems] + ) + ) self.allow = allow self.sandbox = sandbox self.build_graph = build_graph