efmls-configs: Use upstream tool definitions (#692)

This commit is contained in:
traxys 2023-11-06 23:07:55 +01:00 committed by GitHub
parent 9cf2c342a2
commit 6b93c8fa6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 143 deletions

View file

@ -1,5 +1,4 @@
pkgs: rec {
efmls-configs-tools = pkgs.callPackage ./efmls-configs {};
pkgs: {
autogenerated-configs = pkgs.callPackage ({stdenv}:
stdenv.mkDerivation {
pname = "autogenerated-configs";
@ -10,7 +9,6 @@ pkgs: rec {
installPhase = ''
mkdir -p $out
cp ${efmls-configs-tools}/share/* $out
'';
}) {};
}

View file

@ -1,37 +0,0 @@
{
stdenv,
python3,
vimPlugins,
}: let
extract = stdenv.mkDerivation {
pname = "extract_efmls_tools";
version = "1";
src = ./extract.py;
dontUnpack = true;
dontBuild = true;
buildInputs = [python3];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/extract_efmls_tools.py
'';
};
in
stdenv.mkDerivation {
pname = "efmls-configs-tools";
inherit (vimPlugins.efmls-configs-nvim) version src;
nativeBuildInputs = [extract];
buildPhase = ''
extract_efmls_tools.py ./lua/efmls-configs > efmls-configs-tools.json
'';
installPhase = ''
mkdir -p $out/share
cp efmls-configs-tools.json $out/share
'';
}

View file

@ -1,91 +0,0 @@
#!/usr/bin/env python
import sys
import os
import json
tool_path = sys.argv[1]
tools = {
"linters": {},
"formatters": {},
}
identity_langs = [
"bash",
"blade",
"c",
"clojure",
"cmake",
"crystal",
"csh",
"css",
"d",
"dart",
"fish",
"gitcommit",
"go",
"haskell",
"html",
"java",
"javascript",
"json",
"jsonc",
"ksh",
"less",
"lua",
"make",
"markdown",
"nix",
"pawn",
"php",
"proto",
"python",
"roslyn",
"ruby",
"rust",
"sass",
"scala",
"scss",
"sh",
"slim",
"sml",
"solidity",
"sql",
"tex",
"toml",
"typescript",
"vala",
"vim",
"yaml",
"zsh",
"misc",
]
lang_map = {
"c#": "cs",
"c++": "cpp",
"docker": "dockerfile",
"objective-c": "objc",
"objective-c++": "objcpp",
"terraform": "tf",
}
for lang in identity_langs:
lang_map[lang] = lang
for kind in ["linters", "formatters"]:
for file in os.listdir(tool_path + "/" + kind):
tool_name = file.removesuffix(".lua")
languages = []
with open(tool_path + "/" + kind + "/" + file) as f:
for line in f.readlines():
if line.startswith("-- languages:"):
languages = [
lang_map[l.strip()]
for l in line.split(":")[1].strip().split(",")
]
break
tools[kind][tool_name] = languages
print(json.dumps(tools, indent=4, sort_keys=True))