vimPlugins: Automatically sort vim-plugin-names.
Python's `sorted` method works a little differently than `sort` in the handling of dashes.
This commit is contained in:
parent
cffb6cb637
commit
b886ad90e7
@ -11,7 +11,6 @@ let
|
||||
|
||||
# TL;DR
|
||||
# * Add your plugin to ./vim-plugin-names
|
||||
# * sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names
|
||||
# * run ./update.py
|
||||
#
|
||||
# If additional modifications to the build process are required,
|
||||
|
@ -9,7 +9,6 @@
|
||||
# $ nix run nixpkgs.python3Packages.flake8 -c flake8 --ignore E501,E265 update.py
|
||||
|
||||
import argparse
|
||||
import fileinput
|
||||
import functools
|
||||
import http
|
||||
import json
|
||||
@ -124,7 +123,7 @@ class Repo:
|
||||
new_owner, new_name = (
|
||||
urllib.parse.urlsplit(response_url).path.strip("/").split("/")[:2]
|
||||
)
|
||||
end_line = f" as {self.alias}\n" if self.alias else "\n"
|
||||
end_line = "\n" if self.alias is None else f" as {self.alias}\n"
|
||||
plugin_line = "{owner}/{name}" + end_line
|
||||
|
||||
old_plugin = plugin_line.format(owner=self.owner, name=self.name)
|
||||
@ -416,11 +415,12 @@ in lib.fix' (lib.extends overrides packages)
|
||||
print(f"updated {outfile}")
|
||||
|
||||
|
||||
def update_redirects(input_file: Path, output_file: Path, redirects: dict):
|
||||
with fileinput.input(input_file, inplace=True) as f:
|
||||
for line in f:
|
||||
line = " ".join(line.split())
|
||||
print(redirects.get(line, line), end="")
|
||||
def rewrite_input(input_file: Path, output_file: Path, redirects: dict):
|
||||
with open(input_file, "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
if redirects:
|
||||
lines = [redirects.get(line, line) for line in lines]
|
||||
print(
|
||||
f"""\
|
||||
Redirects have been detected and {input_file} has been updated. Please take the
|
||||
@ -430,17 +430,20 @@ following steps:
|
||||
git commit -m "vimPlugins: Update"
|
||||
2. If any of the plugin names were changed, throw an error in aliases.nix:
|
||||
<oldName> = deprecateName "<oldName>" "<newName>"; # backwards compat, added YYYY-MM-DD
|
||||
3. Make sure the updated {input_file} is still correctly sorted:
|
||||
sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names
|
||||
4. Run this script again so these changes will be reflected in the
|
||||
3. Run this script again so these changes will be reflected in the
|
||||
generated expressions:
|
||||
./update.py
|
||||
5. Commit {input_file} along with aliases and generated expressions:
|
||||
4. Commit {input_file} along with aliases and generated expressions:
|
||||
git add {output_file} {input_file} aliases.nix
|
||||
git commit -m "vimPlugins: Update redirects"
|
||||
"""
|
||||
"""
|
||||
)
|
||||
|
||||
lines = sorted(lines, key=str.casefold)
|
||||
|
||||
with open(input_file, "w") as f:
|
||||
f.writelines(lines)
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
@ -488,8 +491,7 @@ def main() -> None:
|
||||
|
||||
generate_nix(plugins, args.outfile)
|
||||
|
||||
if redirects:
|
||||
update_redirects(args.input_file, args.outfile, redirects)
|
||||
rewrite_input(args.input_file, args.outfile, redirects)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -55,8 +55,8 @@ cocopon/iceberg.vim
|
||||
cohama/lexima.vim
|
||||
ctjhoa/spacevim
|
||||
ctrlpvim/ctrlp.vim
|
||||
dag/vim2hs
|
||||
dag/vim-fish
|
||||
dag/vim2hs
|
||||
dannyob/quickfixstatus
|
||||
darfink/starsearch.vim
|
||||
dart-lang/dart-vim-plugin
|
||||
@ -315,8 +315,8 @@ neoclide/coc-neco
|
||||
neoclide/coc-pairs
|
||||
neoclide/coc-prettier
|
||||
neoclide/coc-python
|
||||
neoclide/coc-rls
|
||||
neoclide/coc-r-lsp
|
||||
neoclide/coc-rls
|
||||
neoclide/coc-smartf
|
||||
neoclide/coc-snippets
|
||||
neoclide/coc-solargraph
|
||||
@ -334,10 +334,10 @@ neoclide/denite-extra
|
||||
neoclide/denite-git
|
||||
neoclide/vim-easygit
|
||||
neomake/neomake
|
||||
neovim/nvim-lsp
|
||||
neovim/nvimdev.nvim
|
||||
neovimhaskell/haskell-vim
|
||||
neovimhaskell/nvim-hs.vim
|
||||
neovim/nvimdev.nvim
|
||||
neovim/nvim-lsp
|
||||
neutaaaaan/iosvkem
|
||||
nfnty/vim-nftables
|
||||
nicoe/deoplete-khard
|
||||
@ -505,16 +505,14 @@ Valodim/deoplete-notmuch
|
||||
vhda/verilog_systemverilog.vim
|
||||
vim-airline/vim-airline
|
||||
vim-airline/vim-airline-themes
|
||||
vimlab/split-term.vim
|
||||
vimoutliner/vimoutliner
|
||||
vim-pandoc/vim-pandoc
|
||||
vim-pandoc/vim-pandoc-after
|
||||
vim-pandoc/vim-pandoc-syntax
|
||||
vim-ruby/vim-ruby
|
||||
vim-scripts/a.vim
|
||||
vim-scripts/align
|
||||
vim-scripts/argtextobj.vim
|
||||
vim-scripts/autoload_cscope.vim
|
||||
vim-scripts/a.vim
|
||||
vim-scripts/bats.vim
|
||||
vim-scripts/changeColorScheme.vim
|
||||
vim-scripts/Colour-Sampler-Pack
|
||||
@ -538,6 +536,8 @@ vim-scripts/wombat256.vim
|
||||
vim-scripts/YankRing.vim
|
||||
vim-syntastic/syntastic
|
||||
vim-utils/vim-husk
|
||||
vimlab/split-term.vim
|
||||
vimoutliner/vimoutliner
|
||||
vimwiki/vimwiki
|
||||
vito-c/jq.vim
|
||||
vmchale/dhall-vim
|
||||
|
Loading…
Reference in New Issue
Block a user