mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-09 12:06:40 -04:00
23 lines
561 B
Nix
23 lines
561 B
Nix
![]() |
{ lib, ... }:
|
||
|
let
|
||
|
inherit (builtins) concatStringsSep filter split;
|
||
|
inherit (lib) isString toLower;
|
||
|
|
||
|
in
|
||
|
{
|
||
|
/* Normalize package name as documented in https://packaging.python.org/en/latest/specifications/name-normalization/#normalization
|
||
|
|
||
|
Type: normalizePackageName :: string -> string
|
||
|
|
||
|
Example:
|
||
|
# readPyproject "Friendly-Bard"
|
||
|
"friendly-bard"
|
||
|
*/
|
||
|
normalizePackageName =
|
||
|
let
|
||
|
concatDash = concatStringsSep "-";
|
||
|
splitSep = split "[-_\.]+";
|
||
|
in
|
||
|
name: toLower (concatDash (filter isString (splitSep name)));
|
||
|
}
|