diff options
author | nicoo <nicoo@mur.at> | 2023-09-12 11:41:36 +0000 |
---|---|---|
committer | nicoo <nicoo@mur.at> | 2023-09-12 11:41:36 +0000 |
commit | 8dcbced52ae7973a28193d89bbb105a1522230a7 (patch) | |
tree | a93c4ecb31a8246d74e98b2582f0553621603e49 /maintainers/scripts | |
parent | 78058d810644f5ed276804ce7ea9e82d92bee293 (diff) | |
download | nixlib-8dcbced52ae7973a28193d89bbb105a1522230a7.tar nixlib-8dcbced52ae7973a28193d89bbb105a1522230a7.tar.gz nixlib-8dcbced52ae7973a28193d89bbb105a1522230a7.tar.bz2 nixlib-8dcbced52ae7973a28193d89bbb105a1522230a7.tar.lz nixlib-8dcbced52ae7973a28193d89bbb105a1522230a7.tar.xz nixlib-8dcbced52ae7973a28193d89bbb105a1522230a7.tar.zst nixlib-8dcbced52ae7973a28193d89bbb105a1522230a7.zip |
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
Diffstat (limited to 'maintainers/scripts')
-rwxr-xr-x | maintainers/scripts/remove-old-aliases.py | 9 |
1 files changed, 5 insertions, 4 deletions
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)) |