diff --git a/pkgs/misc/vim-plugins/aliases.nix b/pkgs/misc/vim-plugins/aliases.nix index cfdd629369c03..74061dcfd588b 100644 --- a/pkgs/misc/vim-plugins/aliases.nix +++ b/pkgs/misc/vim-plugins/aliases.nix @@ -30,9 +30,13 @@ let (removeRecurseForDerivations (checkInPkgs n alias))) aliases; -in -mapAliases { + deprecations = lib.mapAttrs (old: info: + throw "${old} was renamed to ${info.new} on ${info.date}. Please update to ${info.new}." + ) (builtins.fromJSON (builtins.readFile ./deprecated.json)); + +in +mapAliases ({ airline = vim-airline; alternative = a-vim; # backwards compat, added 2014-10-21 bats = bats-vim; @@ -67,7 +71,7 @@ mapAliases { ghc-mod-vim = ghcmod-vim; ghcmod = ghcmod-vim; goyo = goyo-vim; - Gist = gist-vim; + Gist = vim-gist; gitgutter = vim-gitgutter; gundo = gundo-vim; Gundo = gundo-vim; # backwards compat, added 2015-10-03 @@ -133,7 +137,6 @@ mapAliases { wombat256 = wombat256-vim; # backwards compat, added 2015-7-8 yankring = YankRing-vim; Yankring = YankRing-vim; - YouCompleteMe = youcompleteme; xterm-color-table = xterm-color-table-vim; zeavim = zeavim-vim; -} +} // deprecations) diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index 20cbbf275c3ab..e6bca9484a260 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -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, diff --git a/pkgs/misc/vim-plugins/deprecated.json b/pkgs/misc/vim-plugins/deprecated.json new file mode 100644 index 0000000000000..2c02982f6c609 --- /dev/null +++ b/pkgs/misc/vim-plugins/deprecated.json @@ -0,0 +1,18 @@ +{ + "gist-vim": { + "date": "2020-03-27", + "new": "vim-gist" + }, + "vim-jade": { + "date": "2020-03-27", + "new": "vim-pug" + }, + "vundle": { + "date": "2020-03-27", + "new": "Vundle.vim" + }, + "youcompleteme": { + "date": "2020-03-27", + "new": "YouCompleteMe" + } +} \ No newline at end of file diff --git a/pkgs/misc/vim-plugins/generated.nix b/pkgs/misc/vim-plugins/generated.nix index 06667caf5c83f..1d39465ddf803 100644 --- a/pkgs/misc/vim-plugins/generated.nix +++ b/pkgs/misc/vim-plugins/generated.nix @@ -63,7 +63,7 @@ let pname = "ale"; version = "2020-03-11"; src = fetchFromGitHub { - owner = "w0rp"; + owner = "dense-analysis"; repo = "ale"; rev = "bbe5153fcb36dec9860ced33ae8ff0b5d76ac02a"; sha256 = "1xvmh66lgii98z6f4lk1mjs73ysrvs55xdlcmf224k3as822jmw0"; @@ -283,7 +283,7 @@ let pname = "clang_complete"; version = "2018-09-19"; src = fetchFromGitHub { - owner = "Rip-Rip"; + owner = "xavierd"; repo = "clang_complete"; rev = "0b98d7533ad967aac3fc4c1a5b0508dafa8a676f"; sha256 = "04mdhc1kbv66blkn6qn98iyj659dac4z49nmpf3anglz8dgcxjgc"; @@ -611,12 +611,12 @@ let coc-tsserver = buildVimPluginFrom2Nix { pname = "coc-tsserver"; - version = "2020-03-09"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "neoclide"; repo = "coc-tsserver"; - rev = "dae0cc36b0245a601d4431ae8dd2319eaa919058"; - sha256 = "1559c0hwyknz1j6vbigywg1fjads4wf8by59z0sri6aah9q77q2z"; + rev = "54bea1ec1ab44802a155f876a4d1cc2c44b2bc42"; + sha256 = "0npjc7c3x9mdqc6asav1f2wwv4p6lb5hk7c1p9b7m3vjg21w0k22"; }; }; @@ -889,7 +889,7 @@ let pname = "denite-extra"; version = "2019-03-29"; src = fetchFromGitHub { - owner = "chemzqm"; + owner = "neoclide"; repo = "denite-extra"; rev = "af18257544027ce89269dba70c12aba1f5b9e23c"; sha256 = "0bmq9yhylfd3v6bfwvakw3pbsz5kk8wlmmql0yllqayp6410w25a"; @@ -900,7 +900,7 @@ let pname = "denite-git"; version = "2020-03-02"; src = fetchFromGitHub { - owner = "chemzqm"; + owner = "neoclide"; repo = "denite-git"; rev = "88b5323a6fc0ace197eed5205215d80f3b613f91"; sha256 = "0b687i64hr8hll7pv7r1xz906b46cl2q62zm18ipikhkpva6iv13"; @@ -909,12 +909,12 @@ let denite-nvim = buildVimPluginFrom2Nix { pname = "denite-nvim"; - version = "2020-03-18"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "Shougo"; repo = "denite.nvim"; - rev = "a184e87b7df5e8f35aee115153b37f178e47718c"; - sha256 = "1na637k62sgpqx69r6j5prad4qdc9dp3psq75jhqyvhm3yq2432w"; + rev = "c3206a06508a197650ee4e1d85da39ff24e3a56b"; + sha256 = "1yy6j5zpja8jr1j8sghwc1l0fkb47r8cvv36ckf75x9x5gpylb5m"; }; }; @@ -933,7 +933,7 @@ let pname = "deoplete-clang"; version = "2019-11-10"; src = fetchFromGitHub { - owner = "zchee"; + owner = "deoplete-plugins"; repo = "deoplete-clang"; rev = "2ea262e98edcb66e828f9077fcc844100320eb63"; sha256 = "1wvk61f8ph2vpl6llzmir3qs3zwaw3lrphs16d1j7ljkdl3bk49k"; @@ -989,7 +989,7 @@ let pname = "deoplete-go"; version = "2020-01-01"; src = fetchFromGitHub { - owner = "zchee"; + owner = "deoplete-plugins"; repo = "deoplete-go"; rev = "4f1ccd2ed70211fd025d052ec725c0b835bea487"; sha256 = "0zmx98kz6pxfpakizr8xm1nrv1rjr0frz19pkik29mk6aj2b2l08"; @@ -1121,12 +1121,12 @@ let deoplete-nvim = buildVimPluginFrom2Nix { pname = "deoplete-nvim"; - version = "2020-03-18"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "Shougo"; repo = "deoplete.nvim"; - rev = "db7d2dc5f416634c9917054bcd6e1e5d925bb4d7"; - sha256 = "1d34zy81j47icsrnbxpp4x9f35ihrmd0lnd0vphi216kdlkxk37b"; + rev = "1439c621dc94016c504e1732ce8270081a42768f"; + sha256 = "1c8qx839zmf52cfazlbbnlhxw6cvnsr3ds0rclawgycbl4s1qy8f"; }; }; @@ -1397,17 +1397,6 @@ let }; }; - gist-vim = buildVimPluginFrom2Nix { - pname = "gist-vim"; - version = "2020-01-29"; - src = fetchFromGitHub { - owner = "mattn"; - repo = "gist-vim"; - rev = "2158eceb210b0a354bc17aa4144554e5d8bb6c79"; - sha256 = "1dz33c63q7gghz35hyrvbshqw20faccs7bvxlda5w70mkbz9h9c4"; - }; - }; - gitignore-vim = buildVimPluginFrom2Nix { pname = "gitignore-vim"; version = "2014-03-16"; @@ -2027,12 +2016,12 @@ let neoformat = buildVimPluginFrom2Nix { pname = "neoformat"; - version = "2020-03-03"; + version = "2020-03-20"; src = fetchFromGitHub { owner = "sbdchd"; repo = "neoformat"; - rev = "69140aedb7da5a5a0b25b82e7f756f91d08170ea"; - sha256 = "132ksy20rb01xm18zwwl3lv5zapfhfvaf5zz6md8dnr5hvkvvrgx"; + rev = "d02b169e70bd6d2b2365bf6cda721967616a30bf"; + sha256 = "1cya26wfqc7l7dqy854m4kwrq3w66knmn2cgviqh9cnsjzhwxs0d"; }; }; @@ -2150,7 +2139,7 @@ let pname = "nerdcommenter"; version = "2020-02-19"; src = fetchFromGitHub { - owner = "scrooloose"; + owner = "preservim"; repo = "nerdcommenter"; rev = "c62e618a1ab5a50a4028e3296500ba29d9b033d8"; sha256 = "0w4bxj423dxxkcxnfmipf8x5jfm058rq4g3m98wzcz5zbambv3qs"; @@ -2161,7 +2150,7 @@ let pname = "nerdtree"; version = "2020-02-20"; src = fetchFromGitHub { - owner = "scrooloose"; + owner = "preservim"; repo = "nerdtree"; rev = "e67324fdea7a192c7ce1b4c6b3c3b9f82f11eee7"; sha256 = "0y7hd69k0i21cqgs11n80ljv6cl0gfcjjwa0dvdywpd8mmn1ad4k"; @@ -2258,12 +2247,12 @@ let nvim-lsp = buildVimPluginFrom2Nix { pname = "nvim-lsp"; - version = "2020-03-19"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "neovim"; repo = "nvim-lsp"; - rev = "6d5e81c71bb90568b3bf9ca061980b9b30cdbc15"; - sha256 = "1va480pw7nk650bmh4z7rvr2a5sqd4q86y19341p6mj12p2r2fcv"; + rev = "4fe58ec4e1fa3500c7ef98464174bf6c4cb8ce67"; + sha256 = "1xyqbr0f2pgvbbk0cpg92pswavff910hy8rjkm05grhqw43vkzcg"; }; }; @@ -2447,7 +2436,7 @@ let pname = "purescript-vim"; version = "2018-12-10"; src = fetchFromGitHub { - owner = "raichoo"; + owner = "purescript-contrib"; repo = "purescript-vim"; rev = "67ca4dc4a0291e5d8c8da48bffc0f3d2c9739e7f"; sha256 = "1insh39hzbynr6qxb215qxhpifl5m8i5i0d09a3b6v679i7s11i8"; @@ -2590,7 +2579,7 @@ let pname = "riv-vim"; version = "2020-02-17"; src = fetchFromGitHub { - owner = "Rykka"; + owner = "gu-fan"; repo = "riv.vim"; rev = "d52844691ca2f139e4b634db65aa49c57a0fc2b3"; sha256 = "0s4jvqwlnmmh2zw9v9rlwynwx44ypdrzhhyfb20sippxg9g6z0c5"; @@ -2821,7 +2810,7 @@ let pname = "sved"; version = "2019-01-25"; src = fetchFromGitHub { - owner = "peder2tm"; + owner = "peterbjorgensen"; repo = "sved"; rev = "3362db72447e8ac812c7299c15ecfc9f41341713"; sha256 = "1r2nv069d6r2q6gbiz795x94mfjm9hnv05zka085hhq9a3yf1pgx"; @@ -2843,7 +2832,7 @@ let pname = "syntastic"; version = "2020-01-29"; src = fetchFromGitHub { - owner = "scrooloose"; + owner = "vim-syntastic"; repo = "syntastic"; rev = "f3766538720116f099a8b1517f76ae2f094afd20"; sha256 = "1bzjav87fcibwlp8siqnx6x8wv8w3mwrrqrd5w19ny9scr5x2a65"; @@ -3568,12 +3557,12 @@ let vim-codefmt = buildVimPluginFrom2Nix { pname = "vim-codefmt"; - version = "2020-02-26"; + version = "2020-03-20"; src = fetchFromGitHub { owner = "google"; repo = "vim-codefmt"; - rev = "6d69f933f243ed3d7797641bd41c0e65d245c931"; - sha256 = "0vzzyz7v03ihky3vx12rji4l1r6vbxgslvc1fvi4dznfqn5m9gfn"; + rev = "d6676620f7a85fa49e8893cad041df59497fd845"; + sha256 = "01wrlq9h2wzngi8qna0zrwycrp0iqp7qsijyby287zbckrs25rnd"; }; }; @@ -3867,7 +3856,7 @@ let pname = "vim-elixir"; version = "2020-03-11"; src = fetchFromGitHub { - owner = "elixir-lang"; + owner = "elixir-editors"; repo = "vim-elixir"; rev = "088cfc407460dea7b81c10b29db23843f85e7919"; sha256 = "1w9w4arzlbjhd5kcvyv5fykq9djc4n4j1nc75qqlzsfggbjjwhbk"; @@ -4041,11 +4030,11 @@ let vim-fugitive = buildVimPluginFrom2Nix { pname = "vim-fugitive"; - version = "2020-03-12"; + version = "2020-03-22"; src = fetchFromGitHub { owner = "tpope"; repo = "vim-fugitive"; - rev = "9a4d730270882f9d39a411eb126143eda4d46963"; + rev = "0e35c9bbc78159318e7b7ffd228f09a96afb8fde"; sha256 = "098fz3lmfysv6gr5cjwgqsdzxjxygwc0x4ak1sxj3h6djys5x66b"; }; }; @@ -4061,6 +4050,17 @@ let }; }; + vim-gist = buildVimPluginFrom2Nix { + pname = "vim-gist"; + version = "2020-01-29"; + src = fetchFromGitHub { + owner = "mattn"; + repo = "vim-gist"; + rev = "2158eceb210b0a354bc17aa4144554e5d8bb6c79"; + sha256 = "1dz33c63q7gghz35hyrvbshqw20faccs7bvxlda5w70mkbz9h9c4"; + }; + }; + vim-gista = buildVimPluginFrom2Nix { pname = "vim-gista"; version = "2020-01-04"; @@ -4118,12 +4118,12 @@ let vim-go = buildVimPluginFrom2Nix { pname = "vim-go"; - version = "2020-03-17"; + version = "2020-03-20"; src = fetchFromGitHub { owner = "fatih"; repo = "vim-go"; - rev = "f5d34f40d6757470f40600000c9c08de142d7ced"; - sha256 = "0a2g8f9xza2m07qm4pcj2aqjh1yvs9cxn8f3zima06swfw2ahdh8"; + rev = "50d52bafa00448ca8cde2b0e05b0fe71c9397762"; + sha256 = "1c8dwllscwxiqp409zy7ajwz84bn8g7p9gldqrhx8i9l7q382z0w"; }; }; @@ -4380,17 +4380,6 @@ let }; }; - vim-jade = buildVimPluginFrom2Nix { - pname = "vim-jade"; - version = "2019-09-23"; - src = fetchFromGitHub { - owner = "digitaltoad"; - repo = "vim-jade"; - rev = "ea39cd942cf3194230cf72bfb838901a5344d3b3"; - sha256 = "07141jkfnaia4ydc6qcg0bc06w720l2lzl7bm4bsjwswqrzmhfam"; - }; - }; - vim-janah = buildVimPluginFrom2Nix { pname = "vim-janah"; version = "2018-10-01"; @@ -4614,12 +4603,12 @@ let vim-lsc = buildVimPluginFrom2Nix { pname = "vim-lsc"; - version = "2020-02-11"; + version = "2020-03-22"; src = fetchFromGitHub { owner = "natebosch"; repo = "vim-lsc"; - rev = "62c6f6aa227b1b3ef5e7cf7df9f0a9c1d855d7fe"; - sha256 = "1qimz08rqm4ch6dr0znwxl328593kmz0yxdqq15g1yrw4ig0fi22"; + rev = "3dd7a19e8689847956266e0be1bbfb4ca12da746"; + sha256 = "0dj1b8v9iz67m833x1z3s7jac0jpfxgs43ylc6m0v3al67qcb0mj"; }; }; @@ -5052,6 +5041,17 @@ let }; }; + vim-pug = buildVimPluginFrom2Nix { + pname = "vim-pug"; + version = "2019-09-23"; + src = fetchFromGitHub { + owner = "digitaltoad"; + repo = "vim-pug"; + rev = "ea39cd942cf3194230cf72bfb838901a5344d3b3"; + sha256 = "07141jkfnaia4ydc6qcg0bc06w720l2lzl7bm4bsjwswqrzmhfam"; + }; + }; + vim-puppet = buildVimPluginFrom2Nix { pname = "vim-puppet"; version = "2019-09-16"; @@ -5527,12 +5527,12 @@ let vim-test = buildVimPluginFrom2Nix { pname = "vim-test"; - version = "2020-03-17"; + version = "2020-03-21"; src = fetchFromGitHub { - owner = "janko-m"; + owner = "janko"; repo = "vim-test"; - rev = "d878e9d61f186140f18a7a8a8badc0605d8955ba"; - sha256 = "06kihjif3g00bibx304vz22w2w9z84v0g6a55cxs1hqlc4ygnl8v"; + rev = "b302a325116d8708dc0721b7cd97ff59536f4e75"; + sha256 = "099dzadzhfkhf92lv5cmfk0iawbp40v1rz9xxp462hxxcn3p3c97"; }; }; @@ -5945,12 +5945,12 @@ let vimtex = buildVimPluginFrom2Nix { pname = "vimtex"; - version = "2020-03-17"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "lervag"; repo = "vimtex"; - rev = "16b23314b31862510d3feb8a2569199062b083ac"; - sha256 = "0vibfwsyamp4jqbaaa872m922yg89fx7k0cfa6kfhr5ks4vhpya5"; + rev = "8c59031d50feeec8b4f3549f70f82564975265f0"; + sha256 = "16a7qpp19gci8hq8h2999pwv0gd6x0mqgifv325mlb0jj5lxy7m1"; }; }; @@ -5998,12 +5998,12 @@ let }; }; - vundle = buildVimPluginFrom2Nix { - pname = "vundle"; + Vundle-vim = buildVimPluginFrom2Nix { + pname = "Vundle-vim"; version = "2019-08-17"; src = fetchFromGitHub { - owner = "gmarik"; - repo = "vundle"; + owner = "VundleVim"; + repo = "Vundle.vim"; rev = "b255382d6242d7ea3877bf059d2934125e0c4d95"; sha256 = "0fkmklcq3fgvd6x6irz9bgyvcdaxafykk3k89gsi9p6b0ikw3rw6"; }; @@ -6099,22 +6099,22 @@ let yats-vim = buildVimPluginFrom2Nix { pname = "yats-vim"; - version = "2020-03-02"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "HerringtonDarkholme"; repo = "yats.vim"; - rev = "68ef9623656fe9aaa53c1d9ab906f09c2c095f06"; - sha256 = "0cn1k8lda71vm4gx14ly9gdvk1j17jds0axx9jvjp4w9jid6ksqk"; + rev = "4d3f69a3a5f56bae9475a96c3291ffdcbd9ff0b1"; + sha256 = "0f3dq4lrm9xzh780fd471b7ddibfzb9vfq1k6gn53pmqpiw6a498"; fetchSubmodules = true; }; }; - youcompleteme = buildVimPluginFrom2Nix { - pname = "youcompleteme"; + YouCompleteMe = buildVimPluginFrom2Nix { + pname = "YouCompleteMe"; version = "2020-03-18"; src = fetchFromGitHub { - owner = "valloric"; - repo = "youcompleteme"; + owner = "ycm-core"; + repo = "YouCompleteMe"; rev = "cf4a76acaeed27eb3ca1dca5adf1115b6abbcfa3"; sha256 = "0si9by2ag2f7xgxidp5215d6wkg1mdhq9j5c4icdpsly9gv3w5s8"; fetchSubmodules = true; @@ -6158,7 +6158,7 @@ let pname = "zig-vim"; version = "2020-02-10"; src = fetchFromGitHub { - owner = "zig-lang"; + owner = "ziglang"; repo = "zig.vim"; rev = "55b690029791022fd7818ebd0ee395e8976899fe"; sha256 = "10xkrn4yhjda187mpw1y3qw0s6bp7aklk87pansaa3fvysdf3b6c"; diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix index e4710e27193ca..5248a817f43ea 100644 --- a/pkgs/misc/vim-plugins/overrides.nix +++ b/pkgs/misc/vim-plugins/overrides.nix @@ -393,7 +393,7 @@ self: super: { configurePhase = "cd plugins/nvim"; }); - gist-vim = super.gist-vim.overrideAttrs(old: { + vim-gist = super.vim-gist.overrideAttrs(old: { dependencies = with super; [ webapi-vim ]; }); @@ -640,7 +640,7 @@ self: super: { sourceRoot = "."; }); - youcompleteme = super.youcompleteme.overrideAttrs(old: { + YouCompleteMe = super.YouCompleteMe.overrideAttrs(old: { buildPhase = '' substituteInPlace plugin/youcompleteme.vim \ --replace "'ycm_path_to_python_interpreter', '''" \ diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py index 0ef93ac569ab0..bbeef0889f422 100755 --- a/pkgs/misc/vim-plugins/update.py +++ b/pkgs/misc/vim-plugins/update.py @@ -10,12 +10,14 @@ import argparse import functools +import http import json import os import subprocess import sys import traceback import urllib.error +import urllib.parse import urllib.request import xml.etree.ElementTree as ET from datetime import datetime @@ -32,6 +34,7 @@ ROOT = Path(__file__).parent DEFAULT_IN = ROOT.joinpath("vim-plugin-names") DEFAULT_OUT = ROOT.joinpath("generated.nix") +DEPRECATED = ROOT.joinpath("deprecated.json") import time from functools import wraps @@ -71,9 +74,11 @@ def f_retry(*args: Any, **kwargs: Any) -> Any: class Repo: - def __init__(self, owner: str, name: str) -> None: + def __init__(self, owner: str, name: str, alias: str) -> None: self.owner = owner self.name = name + self.alias = alias + self.redirect: Dict[str, str] = {} def url(self, path: str) -> str: return urljoin(f"https://github.com/{self.owner}/{self.name}/", path) @@ -96,7 +101,9 @@ def has_submodules(self) -> bool: @retry(urllib.error.URLError, tries=4, delay=3, backoff=2) def latest_commit(self) -> Tuple[str, datetime]: - with urllib.request.urlopen(self.url("commits/master.atom"), timeout=10) as req: + commit_url = self.url("commits/master.atom") + with urllib.request.urlopen(commit_url, timeout=10) as req: + self.check_for_redirect(commit_url, req) xml = req.read() root = ET.fromstring(xml) latest_entry = root.find(ATOM_ENTRY) @@ -111,6 +118,19 @@ def latest_commit(self) -> Tuple[str, datetime]: updated = datetime.strptime(updated_tag.text, "%Y-%m-%dT%H:%M:%SZ") return Path(str(url.path)).name, updated + def check_for_redirect(self, url: str, req: http.client.HTTPResponse): + response_url = req.geturl() + if url != response_url: + new_owner, new_name = ( + urllib.parse.urlsplit(response_url).path.strip("/").split("/")[:2] + ) + 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) + new_plugin = plugin_line.format(owner=new_owner, name=new_name) + self.redirect[old_plugin] = new_plugin + def prefetch_git(self, ref: str) -> str: data = subprocess.check_output( ["nix-prefetch-git", "--fetch-submodules", self.url(""), ref] @@ -197,15 +217,17 @@ def get_current_plugins() -> List[Plugin]: return plugins -def prefetch_plugin(user: str, repo_name: str, alias: str, cache: "Cache") -> Plugin: - repo = Repo(user, repo_name) +def prefetch_plugin( + user: str, repo_name: str, alias: str, cache: "Cache" +) -> Tuple[Plugin, Dict[str, str]]: + repo = Repo(user, repo_name, alias) commit, date = repo.latest_commit() has_submodules = repo.has_submodules() cached_plugin = cache[commit] if cached_plugin is not None: cached_plugin.name = alias or repo_name cached_plugin.date = date - return cached_plugin + return cached_plugin, repo.redirect print(f"prefetch {user}/{repo_name}") if has_submodules: @@ -213,7 +235,10 @@ def prefetch_plugin(user: str, repo_name: str, alias: str, cache: "Cache") -> Pl else: sha256 = repo.prefetch_github(commit) - return Plugin(alias or repo_name, commit, has_submodules, sha256, date=date) + return ( + Plugin(alias or repo_name, commit, has_submodules, sha256, date=date), + repo.redirect, + ) def print_download_error(plugin: str, ex: Exception): @@ -227,20 +252,22 @@ def print_download_error(plugin: str, ex: Exception): def check_results( - results: List[Tuple[str, str, Union[Exception, Plugin]]] -) -> List[Tuple[str, str, Plugin]]: + results: List[Tuple[str, str, Union[Exception, Plugin], Dict[str, str]]] +) -> Tuple[List[Tuple[str, str, Plugin]], Dict[str, str]]: failures: List[Tuple[str, Exception]] = [] plugins = [] - for (owner, name, result) in results: + redirects: Dict[str, str] = {} + for (owner, name, result, redirect) in results: if isinstance(result, Exception): failures.append((name, result)) else: plugins.append((owner, name, result)) + redirects.update(redirect) print(f"{len(results) - len(failures)} plugins were checked", end="") if len(failures) == 0: print() - return plugins + return plugins, redirects else: print(f", {len(failures)} plugin(s) could not be downloaded:\n") @@ -328,15 +355,15 @@ def __setitem__(self, key: str, value: Plugin) -> None: def prefetch( args: Tuple[str, str, str], cache: Cache -) -> Tuple[str, str, Union[Exception, Plugin]]: +) -> Tuple[str, str, Union[Exception, Plugin], dict]: assert len(args) == 3 owner, repo, alias = args try: - plugin = prefetch_plugin(owner, repo, alias, cache) + plugin, redirect = prefetch_plugin(owner, repo, alias, cache) cache[plugin.commit] = plugin - return (owner, repo, plugin) + return (owner, repo, plugin, redirect) except Exception as e: - return (owner, repo, e) + return (owner, repo, e, {}) header = ( @@ -386,6 +413,49 @@ def generate_nix(plugins: List[Tuple[str, str, Plugin]], outfile: str): print(f"updated {outfile}") +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] + + cur_date_iso = datetime.now().strftime("%Y-%m-%d") + with open(DEPRECATED, "r") as f: + deprecations = json.load(f) + for old, new in redirects.items(): + old_name = old.split("/")[1].split(" ")[0].strip("\n") + new_name = new.split("/")[1].split(" ")[0].strip("\n") + if old_name != new_name: + deprecations[old_name] = { + "new": new_name, + "date": cur_date_iso, + } + with open(DEPRECATED, "w") as f: + json.dump(deprecations, f, indent=4, sort_keys=True) + + print( + f"""\ +Redirects have been detected and {input_file} has been updated. Please take the +following steps: + 1. Go ahead and commit just the updated expressions as you intended to do: + git add {output_file} + git commit -m "vimPlugins: Update" + 2. Run this script again so these changes will be reflected in the + generated expressions: + ./update.py + 3. Commit {input_file} along with deprecations and generated expressions: + git add {output_file} {input_file} {DEPRECATED} + 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( description=( @@ -428,10 +498,12 @@ def main() -> None: finally: cache.store() - plugins = check_results(results) + plugins, redirects = check_results(results) generate_nix(plugins, args.outfile) + rewrite_input(args.input_file, args.outfile, redirects) + if __name__ == "__main__": main() diff --git a/pkgs/misc/vim-plugins/vim-plugin-names b/pkgs/misc/vim-plugins/vim-plugin-names index 874b2471d5c47..8ec4e90e39447 100644 --- a/pkgs/misc/vim-plugins/vim-plugin-names +++ b/pkgs/misc/vim-plugins/vim-plugin-names @@ -20,8 +20,8 @@ autozimu/LanguageClient-neovim ayu-theme/ayu-vim bazelbuild/vim-bazel bbchung/clighter8 -benmills/vimux benizi/vim-automkdir +benmills/vimux bhurlow/vim-parinfer bitc/vim-hdevtools bkad/camelcasemotion @@ -35,8 +35,6 @@ brooth/far.vim carlitux/deoplete-ternjs ccarpita/rtorrent-syntax-file cespare/vim-toml -chemzqm/denite-extra -chemzqm/denite-git Chiel92/vim-autoformat chikatoike/concealedyank.vim chikatoike/sourcemap.vim @@ -57,22 +55,25 @@ 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 david-a-wheeler/vim-metamath davidhalter/jedi-vim dcharbon/vim-flatbuffers +dense-analysis/ale +deoplete-plugins/deoplete-clang deoplete-plugins/deoplete-dictionary +deoplete-plugins/deoplete-go deoplete-plugins/deoplete-jedi deoplete-plugins/deoplete-zsh derekelkins/agda-vim derekwyatt/vim-scala dhruvasagar/vim-prosession dhruvasagar/vim-table-mode -digitaltoad/vim-jade +digitaltoad/vim-pug direnv/direnv.vim dleonard0/pony-vim-syntax dracula/vim @@ -85,7 +86,7 @@ easymotion/vim-easymotion editorconfig/editorconfig-vim ehamberg/vim-cute-python eikenb/acp -elixir-lang/vim-elixir +elixir-editors/vim-elixir elmcast/elm-vim elzr/vim-json embear/vim-localvimrc @@ -108,7 +109,6 @@ garbas/vim-snipmate gentoo/gentoo-syntax gibiansky/vim-textobj-haskell glts/vim-textobj-comment -gmarik/vundle godlygeek/csapprox godlygeek/tabular google/vim-codefmt @@ -117,6 +117,7 @@ google/vim-maktaba gorkunov/smartpairs.vim gotcha/vimelette gregsexton/gitv +gu-fan/riv.vim guns/vim-clojure-highlight guns/vim-clojure-static guns/vim-sexp @@ -147,7 +148,7 @@ itchyny/vim-cursorword itchyny/vim-gitbranch ivanov/vim-ipython jacoborus/tender.vim -janko-m/vim-test +janko/vim-test jaredgorski/SpaceCamp JazzCore/ctrlp-cmatcher jceb/vim-hier @@ -259,7 +260,7 @@ markonm/traces.vim martinda/Jenkinsfile-vim-syntax mattn/calendar-vim as mattn-calendar-vim mattn/emmet-vim -mattn/gist-vim +mattn/vim-gist mattn/webapi-vim matze/vim-move maximbaz/lightline-ale @@ -314,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 @@ -329,12 +330,14 @@ neoclide/coc-vimtex neoclide/coc-wxml neoclide/coc-yaml neoclide/coc-yank +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 @@ -355,7 +358,7 @@ osyo-manga/vim-watchdogs pangloss/vim-javascript parsonsmatt/intero-neovim pearofducks/ansible-vim -peder2tm/sved +peterbjorgensen/sved peterhoeg/vim-qml phanviet/vim-monokai-pro plasticboy/vim-markdown @@ -363,7 +366,10 @@ ponko2/deoplete-fish posva/vim-vue powerman/vim-plugin-AnsiEsc PProvost/vim-ps1 +preservim/nerdcommenter +preservim/nerdtree ptzz/lf.vim +purescript-contrib/purescript-vim python-mode/python-mode qnighy/lalrpop.vim qpkorr/vim-bufkill @@ -372,7 +378,6 @@ racer-rust/vim-racer rafaqz/ranger.vim rafi/awesome-vim-colorschemes raghur/vim-ghost -raichoo/purescript-vim Raimondi/delimitMate rakr/vim-one rbgrouleff/bclose.vim @@ -381,7 +386,6 @@ reedes/vim-wordy rhysd/committia.vim rhysd/vim-grammarous rhysd/vim-operator-surround -Rip-Rip/clang_complete rodjek/vim-puppet romainl/vim-cool ron89/thesaurus_query.vim @@ -391,15 +395,11 @@ roxma/nvim-yarp RRethy/vim-illuminate rust-lang/rust.vim ryanoasis/vim-devicons -Rykka/riv.vim ryvnf/readline.vim sakhnik/nvim-gdb saltstack/salt-vim samoshkin/vim-mergetool sbdchd/neoformat -scrooloose/nerdcommenter -scrooloose/nerdtree -scrooloose/syntastic sebastianmarkow/deoplete-rust SevereOverfl0w/deoplete-github sheerun/vim-polyglot @@ -501,21 +501,18 @@ uarun/vim-protobuf udalov/kotlin-vim ujihisa/neco-look unblevable/quick-scope -valloric/youcompleteme 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 @@ -537,11 +534,14 @@ vim-scripts/taglist.vim vim-scripts/utl.vim 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 -w0rp/ale +VundleVim/Vundle.vim wakatime/vim-wakatime wannesm/wmgraphviz.vim wellle/targets.vim @@ -550,11 +550,11 @@ will133/vim-dirdiff wincent/command-t wincent/ferret wsdjeg/vim-fetch +xavierd/clang_complete xolox/vim-easytags xolox/vim-misc xuhdev/vim-latex-live-preview +ycm-core/YouCompleteMe Yggdroot/indentLine zah/nim.vim -zchee/deoplete-clang -zchee/deoplete-go -zig-lang/zig.vim +ziglang/zig.vim