From 8dcbced52ae7973a28193d89bbb105a1522230a7 Mon Sep 17 00:00:00 2001 From: nicoo Date: Tue, 12 Sep 2023 11:41:36 +0000 Subject: maintainers/scripts/remove-old-aliases: Drop `pkgs.` prefix if present This should provide nicer `throw` messages, and avoid back-and-forth like https://github.com/NixOS/nixpkgs/pull/254418#discussion_r1322076574 --- maintainers/scripts/remove-old-aliases.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'maintainers/scripts') diff --git a/maintainers/scripts/remove-old-aliases.py b/maintainers/scripts/remove-old-aliases.py index 8f04a9be4f17..3c5f8edc50ad 100755 --- a/maintainers/scripts/remove-old-aliases.py +++ b/maintainers/scripts/remove-old-aliases.py @@ -102,12 +102,13 @@ def convert_to_throw(date_older_list: list[str]) -> list[tuple[str, str]]: alias = before_equal alias_unquoted = before_equal.strip('"') - after_equal_list = [x.strip(";:") for x in after_equal.split()] + replacement = next(x.strip(";:") for x in after_equal.split()) + replacement = replacement.removeprefix("pkgs.") converted = ( - f"{indent}{alias} = throw \"'{alias_unquoted}' has been renamed to/replaced by" - f" '{after_equal_list.pop(0)}'\";" - f' # Converted to throw {datetime.today().strftime("%Y-%m-%d")}' + f"{indent}{alias} = throw \"'{alias_unquoted}' has been" + f" renamed to/replaced by '{replacement}'\";" + f" # Converted to throw {datetime.today().strftime('%Y-%m-%d')}" ) converted_list.append((line, converted)) -- cgit 1.4.1