python3Packages.tree-sitter-grammars: ensure PEP 440 compatible versions
This commit is contained in:
@@ -12,8 +12,20 @@
|
||||
grammarDrv,
|
||||
}:
|
||||
let
|
||||
inherit (grammarDrv) version;
|
||||
|
||||
# Map nix style `0-unstable-YYYY-MM-DD` version identifiers to a PEP 440
|
||||
# compatible form (`0+unstableYYYYMMDD`).
|
||||
version = lib.pipe grammarDrv [
|
||||
lib.getVersion
|
||||
(lib.splitString "-")
|
||||
(
|
||||
parts:
|
||||
let
|
||||
version = lib.head parts;
|
||||
metadata = lib.join "" (lib.tail parts);
|
||||
in
|
||||
if (metadata == "") then version else "${version}+${metadata}"
|
||||
)
|
||||
];
|
||||
snakeCaseName = lib.replaceStrings [ "-" ] [ "_" ] name;
|
||||
drvPrefix = "python-${name}";
|
||||
# If the name of the grammar attribute differs from the grammar's symbol name,
|
||||
|
||||
Reference in New Issue
Block a user