summary refs log tree commit diff
diff options
context:
space:
mode:
authorryneeverett <ryneeverett@gmail.com>2020-03-29 16:09:59 +0000
committerryneeverett <ryneeverett@gmail.com>2020-04-01 14:30:46 +0000
commit1c0f0de46c231d6c392b9727327d9635fc4f60ec (patch)
tree436ed0cf4dc7c74d2e237655799204264d1a598b
parent1f32eb7987b44348b8c20bec0aea60bec836637c (diff)
downloadnixpkgs-1c0f0de46c231d6c392b9727327d9635fc4f60ec.tar
nixpkgs-1c0f0de46c231d6c392b9727327d9635fc4f60ec.tar.gz
nixpkgs-1c0f0de46c231d6c392b9727327d9635fc4f60ec.tar.bz2
nixpkgs-1c0f0de46c231d6c392b9727327d9635fc4f60ec.tar.lz
nixpkgs-1c0f0de46c231d6c392b9727327d9635fc4f60ec.tar.xz
nixpkgs-1c0f0de46c231d6c392b9727327d9635fc4f60ec.tar.zst
nixpkgs-1c0f0de46c231d6c392b9727327d9635fc4f60ec.zip
vimPlugins: normalize deprecation names
Parsing plugin lines in multiple places is hazardous and already manifested a
bug!
-rw-r--r--pkgs/misc/vim-plugins/deprecated.json4
-rwxr-xr-xpkgs/misc/vim-plugins/update.py21
2 files changed, 16 insertions, 9 deletions
diff --git a/pkgs/misc/vim-plugins/deprecated.json b/pkgs/misc/vim-plugins/deprecated.json
index 2c02982f6c6..2af94f5df3d 100644
--- a/pkgs/misc/vim-plugins/deprecated.json
+++ b/pkgs/misc/vim-plugins/deprecated.json
@@ -9,10 +9,10 @@
     },
     "vundle": {
         "date": "2020-03-27",
-        "new": "Vundle.vim"
+        "new": "Vundle-vim"
     },
     "youcompleteme": {
         "date": "2020-03-27",
         "new": "YouCompleteMe"
     }
-}
\ No newline at end of file
+}
diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py
index cea1ae21527..a01bd93a3cc 100755
--- a/pkgs/misc/vim-plugins/update.py
+++ b/pkgs/misc/vim-plugins/update.py
@@ -246,6 +246,11 @@ def prefetch_plugin(
     )
 
 
+def fetch_plugin_from_pluginline(plugin_line: str) -> Plugin:
+    plugin, _ = prefetch_plugin(*parse_plugin_line(plugin_line))
+    return plugin
+
+
 def print_download_error(plugin: str, ex: Exception):
     print(f"{plugin}: {ex}", file=sys.stderr)
     ex_traceback = ex.__traceback__
@@ -418,7 +423,9 @@ in lib.fix' (lib.extends overrides packages)
     print(f"updated {outfile}")
 
 
-def rewrite_input(input_file: Path, redirects: dict = None, append: Tuple = ()):
+def rewrite_input(
+    input_file: Path, redirects: Dict[str, str] = None, append: Tuple = ()
+):
     with open(input_file, "r") as f:
         lines = f.readlines()
 
@@ -431,11 +438,11 @@ def rewrite_input(input_file: Path, redirects: dict = None, append: Tuple = ()):
         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,
+            old_plugin = fetch_plugin_from_pluginline(old)
+            new_plugin = fetch_plugin_from_pluginline(new)
+            if old_plugin.normalized_name != new_plugin.normalized_name:
+                deprecations[old_plugin.normalized_name] = {
+                    "new": new_plugin.normalized_name,
                     "date": cur_date_iso,
                 }
         with open(DEPRECATED, "w") as f:
@@ -574,7 +581,7 @@ def main() -> None:
             rewrite_input(args.input_file, append=(plugin_line + "\n",))
             updater()
 
-            plugin, _ = prefetch_plugin(*parse_plugin_line(plugin_line))
+            plugin = fetch_plugin_from_pluginline(plugin_line)
             nixpkgs_repo.commit(
                 "vimPlugins.{name}: init at {version}".format(
                     name=plugin.normalized_name, version=plugin.version