mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-23 20:44:12 +00:00
vimPlugins: --update-redirects improvements.
In response to @timokau's review here are a couple changes: - Decrease the fragility of the replacement code by normalizing whitespace on each line. - Throw an error when plugins are renamed rather than silently aliasing to the new name.
This commit is contained in:
parent
6601c1699f
commit
a9c9b0d40c
@ -30,6 +30,9 @@ let
|
|||||||
(removeRecurseForDerivations
|
(removeRecurseForDerivations
|
||||||
(checkInPkgs n alias)))
|
(checkInPkgs n alias)))
|
||||||
aliases;
|
aliases;
|
||||||
|
|
||||||
|
deprecateName = oldName: newName:
|
||||||
|
throw "${oldName} was renamed to ${newName}. Please update to ${newName}.";
|
||||||
in
|
in
|
||||||
|
|
||||||
mapAliases {
|
mapAliases {
|
||||||
@ -68,7 +71,7 @@ mapAliases {
|
|||||||
ghcmod = ghcmod-vim;
|
ghcmod = ghcmod-vim;
|
||||||
goyo = goyo-vim;
|
goyo = goyo-vim;
|
||||||
Gist = vim-gist;
|
Gist = vim-gist;
|
||||||
gist-vim = vim-gist; # backwards compat, added 2020-3-22
|
gist-vim = deprecateName "vim-gist" "gist-vim"; # backwards compat, added 2020-3-22
|
||||||
gitgutter = vim-gitgutter;
|
gitgutter = vim-gitgutter;
|
||||||
gundo = gundo-vim;
|
gundo = gundo-vim;
|
||||||
Gundo = gundo-vim; # backwards compat, added 2015-10-03
|
Gundo = gundo-vim; # backwards compat, added 2015-10-03
|
||||||
@ -126,17 +129,17 @@ mapAliases {
|
|||||||
unite = unite-vim;
|
unite = unite-vim;
|
||||||
UltiSnips = ultisnips;
|
UltiSnips = ultisnips;
|
||||||
vim-addon-vim2nix = vim2nix;
|
vim-addon-vim2nix = vim2nix;
|
||||||
vim-jade = vim-pug; # backwards compat, added 2020-3-22
|
vim-jade = deprecateName "vim-pug" "vim-jade"; # backwards compat, added 2020-3-22
|
||||||
vimproc = vimproc-vim;
|
vimproc = vimproc-vim;
|
||||||
vimshell = vimshell-vim;
|
vimshell = vimshell-vim;
|
||||||
vinegar = vim-vinegar;
|
vinegar = vim-vinegar;
|
||||||
vundle = Vundle-vim; # backwards compat, added 2020-3-22
|
vundle = deprecateName "Vundle-vim" "vundle"; # backwards compat, added 2020-3-22
|
||||||
watchdogs = vim-watchdogs;
|
watchdogs = vim-watchdogs;
|
||||||
WebAPI = webapi-vim;
|
WebAPI = webapi-vim;
|
||||||
wombat256 = wombat256-vim; # backwards compat, added 2015-7-8
|
wombat256 = wombat256-vim; # backwards compat, added 2015-7-8
|
||||||
yankring = YankRing-vim;
|
yankring = YankRing-vim;
|
||||||
Yankring = YankRing-vim;
|
Yankring = YankRing-vim;
|
||||||
youcompleteme = YouCompleteMe; # backwards compat, added 2020-3-22
|
youcompleteme = deprecateName "YouCompleteMe" "youcompleteme"; # backwards compat, added 2020-3-22
|
||||||
xterm-color-table = xterm-color-table-vim;
|
xterm-color-table = xterm-color-table-vim;
|
||||||
zeavim = zeavim-vim;
|
zeavim = zeavim-vim;
|
||||||
}
|
}
|
||||||
|
@ -419,6 +419,7 @@ in lib.fix' (lib.extends overrides packages)
|
|||||||
def update_redirects(input_file: Path, output_file: Path, redirects: dict):
|
def update_redirects(input_file: Path, output_file: Path, redirects: dict):
|
||||||
with fileinput.input(input_file, inplace=True) as f:
|
with fileinput.input(input_file, inplace=True) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
line = " ".join(line.split())
|
||||||
print(redirects.get(line, line), end="")
|
print(redirects.get(line, line), end="")
|
||||||
print(
|
print(
|
||||||
f"""\
|
f"""\
|
||||||
@ -427,8 +428,8 @@ following steps:
|
|||||||
1. Go ahead and commit just the updated expressions as you intended to do:
|
1. Go ahead and commit just the updated expressions as you intended to do:
|
||||||
git add {output_file}
|
git add {output_file}
|
||||||
git commit -m "vimPlugins: Update"
|
git commit -m "vimPlugins: Update"
|
||||||
2. If any of the plugin names were changed, add the old names as aliases in
|
2. If any of the plugin names were changed, throw an error in aliases.nix:
|
||||||
aliases.nix
|
<oldName> = deprecateName "<oldName>" "<newName>"; # backwards compat, added YYYY-MM-DD
|
||||||
3. Make sure the updated {input_file} is still correctly sorted:
|
3. Make sure the updated {input_file} is still correctly sorted:
|
||||||
sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names
|
sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names
|
||||||
4. Run this script again so these changes will be reflected in the
|
4. Run this script again so these changes will be reflected in the
|
||||||
|
Loading…
Reference in New Issue
Block a user